i have the following code and the call back function is not being called on form submission
$(document).ready(function () {
var options = {
target: '#output2',
// target element(s) to be updated with server response
beforeSubmit: showRequest,
// pre-submit callback
success: showResponse, // post-submit callback
// other available options:
//url: url // override for form's 'action' attribute
//type: type // 'get' or 'post', override for form's 'method' attribute
//dataType: null // 'xml', 'script', or 'json' (expected server response type)
clearForm: true // clear all form fields after successful submit
//resetForm: true // reset the form after successful submit
// $.ajax options can be used here too, for example:
//timeout: 3000
};
$('#updateStatus').submit(function () {
// make your ajax call
$(this).ajaxSubmit(options);
return false; // prevent a new request
});
function showRequest(formData, jqForm, options) {
$('#StatusMessageMessage').attr('disabled', true);
}
function showResponse(responseText, statusText, xhr, $form) {
$('#StatusMessageMessage').attr('disabled', false);
alert('shdsd');
}
});
I believe you need to be a little bit more specific. Are you talking about the showRequest callback? All that is doing is disabling the object with id StatusMessageMessage. Is there any text in there already? Do you have any visual cues to see that it is enabled or disabled?
As for the showResponse function, it gets called on success. Are you sure the server side code is returning successfully? You don’t show where the form’s action is pointing, or anything about the result you are expecting. Maybe try a test that returns a string, and do nothing except return a static string (typical hello world application).
Let us know if/when you’ve tried that, and what kind of outcome you get from it.