I'm using jQuery's $.ajax
function to submit a form, which works, but the success is where I'm having my problem. Here is my code:
$("#form").submit(function () {
$.ajax({
type: "POST",
url: '/login/spam',
data: formData,
success: function (dataCheck) {
if (dataCheck == 'value') {
//Do stuff
}
}
});
return false;
});
The problem I'm having is the if
function keeps saying that dataCheck doesn't equal value. I know that it does, because when I remove return false;
the page displays value, as expected. Also, I have used an almost identical code before, which works. Could somebody give me some advice?