With the following code I'm trying to execute some actions after the ajaxSubmit, but the success delegate is never fired. The ajaxSubmit code reaches the asp.net controller who succesfully handles the request with an JSON result. The model form contains an button who executes the AjaxSubmitAndClose.
function ShowModal(rendercontainerid, modalcontainerid, url) {
if (url == '')
return;
$.get(url, function(data) {
$(rendercontainerid).html(data);
$(rendercontainerid).modal({
close: false,
containerId: modalcontainerid
});
});
}
function AjaxSubmitAndClose(formid) {
var options = {
beforeSubmit: showRequest,
success: showResponse,
dataType: 'json'
};
$(form).ajaxSubmit(options);
}
function showRequest(formData, jqForm, options)
{
$('#formSub').html('We really appreciate your feedback!');
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.');
}
After investigating this strange behavior I found an open bug.
Then I did a shot in the open and I removed dataType from the Options object and surprisingly everything was working again.