ajaxForm(options)应该传递给选项什么? [英] ajaxForm(options) what should be passed to the options?
问题描述
$(document).ready(function() {
var options = {
target: '#output1', // target element(s) to be updated with server response
beforeSubmit: showRequest, // pre-submit callback
success: showResponse // post-submit callback
};
$('#myForm1').ajaxForm(options);
});
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.');
}
在上面的程序中,在option参数中传递了什么?我使用了 http://jquery.malsup.com /
In the above program what is passed in the option argument?I use the http://jquery.malsup.com/
推荐答案
您的问题是什么?
请详细说明.
ajaxForm
准备要 通过添加所有 必要的事件侦听器.确实 不提交表格.在中使用ajaxForm 您文档的就绪功能 为AJAX准备表格 提交. ajaxForm 取零或一 论点.单个参数可以是 回调函数或 选项对象.可链接:是的.
Prepares a form to be submitted via AJAX by adding all of the necessary event listeners. It does not submit the form. Use ajaxForm in your document's ready function to prepare your form(s) for AJAX submission. ajaxForm takes zero or one argument. The single argument can be either a callback function or an Options Object. Chainable: Yes.
注意:您可以通过任何标准 ajaxForm的$ .ajax选项
Note: You can pass any of the standard $.ajax options to ajaxForm
这篇关于ajaxForm(options)应该传递给选项什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!