I’m using an ajax post like so…
$(document).on("click",".Resend",function() {
$.ajax({
type: "POST",
url: "file.php",
timeout: 3000,
data: dataString,
cache: false,
success: function(myhtml){
// If success
if (myhtml == "success") {
alert(myhtml);
} else {
alert("No");
}
}
});
});
The PHP/HTML that is called back for example is a simple as this…
<?php
echo "success";
?>
For some odd reason I am getting the false return alert = No. Can someone explain to me why this might happen?
Assuming that the page you’re posting to exists, it is possible that the contents of the response includes some white space; therefore, the string comparison would fail.
You can try this: