jQuery的:ajaxSubmit会/当作ajaxForm任何显著的区别?显著、区别、jQuery、ajaxSubmit

2023-09-10 18:10:52 作者:不如看淡别离

不知何故 ajaxSubmit会和当作ajaxForm 还挺起到同样的作用。如果是这样,那么,他们之间有任何显著的区别?如果是这样;它使用的时候,为什么?

Somehow ajaxSubmit and ajaxForm kinda play the same role. If so, then, Is there any significant difference between them ? If so; which to use, when and why?

推荐答案

在常见问题读取:

当作ajaxForm和ajaxSubmit的区别是什么

有这些方法之间有两个主要区别:

There are two main differences between these methods:

   ajaxSubmit会提交表单,ajaxForm不会。当你调用ajaxSubmit会立即序列化表单数据并将其发送到   服务器。当你调用当作ajaxForm它可以添加必要的事件监听器   窗体,以便它可以检测当表单提交   用户。发生这种情况时ajaxSubmit会叫你。   当使用ajaxForm提交表单提交的数据将包括名称和提交元素的值(如果或其点击坐标   提交元素是一个图像)。    ajaxSubmit submits the form, ajaxForm does not. When you invoke ajaxSubmit it immediately serializes the form data and sends it to the server. When you invoke ajaxForm it adds the necessary event listeners to the form so that it can detect when the form is submitted by the user. When this occurs ajaxSubmit is called for you. When using ajaxForm the submitted data will include the name and value of the submitting element (or its click coordinates if the submitting element is an image).

因此​​, ajaxSubmit会实际上将表单提交给它的目的地,而当作ajaxForm prePS一切,等待提交表单。

So, ajaxSubmit actually submits the form to its destination while ajaxForm preps everything and waits for the form to be submitted.

您可以代替 $(#formID)中运行 ajaxSubmit会。提交()

Your could run ajaxSubmit in place of $("#formID").submit()

更新的

UPDATE

在应对下面的评论关于上传进度的选项页在同一网站上说:

In response to the comment below about uploadProgress the Options page on the same site says:

注意:除了下面列出的选项,您还可以通过任何标准的$就选择它当作ajaxForm和ajaxSubmit会

都当作ajaxForm和ajaxSubmit会支持众多的选择   使用一个可选参数对象。

Both ajaxForm and ajaxSubmit support numerous options which can be provided using an Options Object.

没有什么关于上传进度被排除在任何所以我会说上传进度在两种可用。如何这样使用的是一个不同的问题完全; - )

There is nothing on uploadProgress being excluded from either so I would say uploadProgress is available in both. How that's used is a different question altogether ;-)