I have the following code but its getting an empty response when I check in firebug.
Here is the code:
function sendemail() {
var phone = escape($("#phone").val());
var reason = escape($("#reason").val());
var fname = "<?= $_SESSION['fname'];?>";
var lname = "<?= $_SESSION['lname'];?>";
var email = "<?= $_SESSION['email'];;?>";
getAjax("ajax.php?action=sendemail3",
"Please Wait...",
"phone" + phone +" & reason "+reason+" & fname "+fname+" & lname "+lname+" & email "+email");
}
And here is my PHP code:
case "sendemail3":
$name = $_REQUEST['fname'];
$lname = $_REQUEST['lname'];
$to = 'xxx@xxx.edu';
$phone = $_REQUEST['phone'];
$reason = $_REQUEST['reason'];
$subject = 'Verification';
$cont="<html><body style=''>
<div style='width:100%;' >
<div style='width:50%;margin-left:20%'; >
<div style='text-align:center;font-size:16px;padding:5px;'>
<p>Hi $name $lname,</p>
<p>Thank you <p/>
</div></div></div>
</body></html>";
mail ($to, $subject, $cont);
echo "successfully sent";
break;
edit getAjax function
function getAjax(e, t, n) {
var a = null;
return $.ajax({
url: e,
beforeSend: function() {
$("#notify-container").show(), $("#msg").empty().html(t)
},
success: function(e) {
"gotosearch" == e && (window.location.href = "search.php"), "gotoprofile" == e && (window.location.href = "profile.php"), "hostpage" == e && (window.location.href = "search.php"), "tourpage" == e && (window.location.href = "search.php"), "gotohomenot" == e && ($("#email1").val(""), $("#pass1").val(""), $("#invalid").fadeIn("fast"), document.getElementById("invalid1").style.display = "none", document.getElementById("invalid2").style.display = "none"), "gohome" == e && ($("#email1").val(""), $("#pass1").val(""), $("#invalid2").fadeIn("fast"), document.getElementById("invalid1").style.display = "none", document.getElementById("invalid").style.display = "none"), "gonot" == e && ($("#email1").val(""), $("#pass1").val(""), document.getElementById("invalid").style.display = "none", document.getElementById("invalid2").style.display = "none", $("#invalid1").fadeIn("fast"))
},
type: "POST",
data: n,
async: !1
}), a
}
When I check in firebug the values does get send to the in a post but when I look at the response its empty.
Anything I could do to fix it?
Thank you.