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\
If you want to prevent the default behaviour( in this case the normal form submit), use preventDefault over return false; preventDefault will work even if there is a problem in the script which is above return false statement.
The below code should work fine.
$("#form").submit(function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: '/login/spam',
data: formData,
success: function (dataCheck) {
if (dataCheck == 'value') {
//Do stuff
}
}
});
});
As gdoron mentioned, use console.debug/ alert to see what value is in the variables. Using firebug Net tab / fiddler will help you to understand what response you are getting from the server page.