gpt4 book ai didi

jquery - ajaxForm(options) 什么应该传递给选项?

转载 作者:行者123 更新时间:2023-12-03 22:53:17 24 4
gpt4 key购买 nike

$(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.');
}

在上面的程序中,选项参数中传递了什么?我使用 http://jquery.malsup.com/

最佳答案

你的问题是什么?

请详细说明。

来自jQuery Form Plugin API Documentation :

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.

Note: You can pass any of the standard $.ajax options to ajaxForm

关于jquery - ajaxForm(options) 什么应该传递给选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1635836/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com