[jQuery] ajaxSubmit not processing success option
Hi,
I have a contact form set up at www.vinhlewebdesigner.com. I want to submit
the form using ajax and then display a message of success upon successful
completion. Right now it submits the form, processes the beforeSubmit
option, but it does not process the success option. I know this for sure
because I used firebug to break at exactly that point and the submission
went though, but as soon as I resumed the script it will proceed to go to
the script's page without displaying the success alert.
I was wondering if I need to send something back from my php script that
processes it in order to let it know that it was a success? Any help would
be appreciated. Thanks.
All the code in question is in ajax.js at the bottom. Here it is:
// Last check for form validation
$(document).ready(function() {
$('form').submit(function() {
$('#submit-message').remove();
$(':input').trigger('blur');
var numWarnings = $('.warning', this).length;
if (numWarnings) {
$('<div></div>').attr({'id': 'submit-message', 'class': 'warning_last'})
.append('Please fill in all fields.')
.insertBefore('#submit');
return false;
}
var options = {
target: '#submit-message',
beforeSubmit: showRequest,
success: showResponse
}
$(this).ajaxSubmit(options);
return false;
});
});
function showRequest(formData, jqForm, options) {
var queryString = $.param(formData);
alert('About to submit: \n\n' + queryString);
return true;
}
function showResponse(responseText, statusText) {
alert('status:' + statusText + '\n\nresponseText: \n' + responseText +
'\n\nThe output div should have already been updated with the
responseText');
return false;
}
--
View this message in context: http://www.nabble.com/ajaxSubmit-not-processing-success-option-tp15541145s27240p15541145.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.