jquery ajax giving all page as response code example
Example 1: ajax response returns entire page
Use condition to verify if $_POST empty in you main page or index.php to not send the whole page in response ajax
and verif your AJAX URL
$.ajax({
type:"POST",
url:"http://mywebsite.com/php/send_email.php",
.......
index.php
------------------------
<?php
if(empty($_POST)){ ?>
<html>
the header pages
the body
the include pages
the scripts pages
the footer
<?php } ?>
Example 2: jquery ajax post
$.ajax({
type: "POST",
url: url,
data: data,
success: success,
dataType: dataType
});