使用以下代码,我尝试在 ajaxSubmit 之后执行一些操作,但从未触发成功委托。ajaxSubmit 代码到达 asp.net 控制器,该控制器成功处理带有 JSON 结果的请求。模型表单包含一个执行 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.');
}