人気のあるファイル jquery.form.js を含めます。私は次のものを持っています:
var options = {
beforeSubmit: beforeSubmit, // pre-submit callback
success: afterSubmit // post-submit callback
};
$('#myForm').submit(function (e) {
$(this).ajaxSubmit(options);
return false;
});
function afterSubmit(responseText, statusText, xhr, $form) {
// i want to check for an error
}
このアクションを次のように呼びます。
[HttpPost]
public string UploadDocument(DocumentModel model)
{
if (noerror)
return "ok";
else
return "the error";
}
パラメータ「responseText、statusText、xhr、$form」のどこかに戻り文字列が格納されます。
「afterSubmit」JavaScript 関数が呼び出されたときに結果を確認できるように、戻り文字列はどこに保存されますか、またはどのように保存すればよいですか? ありがとう