#[jQuery Form Plugin](http://jquery.malsup.com/form/)
##Overview
The jQuery Form Plugin allows you to easily and unobtrusively upgrade HTML forms to use AJAX. The main methods, ajaxForm and ajaxSubmit, gather information from the form element to determine how to manage the submit process. Both of these methods support numerous options which allows you to have full control over how the data is submitted.
No special markup is needed, just a normal form. Submitting a form with AJAX doesn't get any easier than this!
---
##API
###jqXHR
The jqXHR object is stored in element <em>data</em>-cache with the <code>jqxhr</code> key after each <code>ajaxSubmit</code>
call. It can be accessed like this:
````javascript
var form = $('#myForm').ajaxSubmit({ /* options */ });
var xhr = form.data('jqxhr');
xhr.done(function() {
...
});
````
###ajaxForm( options )
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 existing forms for AJAX submission, or with the `delegation` option to handle forms not yet added to the DOM.
Use ajaxForm when you want the plugin to manage all the event binding for you.
````javascript
// prepare all forms for ajax submission
$('form').ajaxForm({
target: '#myResultsDiv'
});
````
###ajaxSubmit( options )
Immediately submits the form via AJAX. In the most common use case this is invoked in response to the user clicking a submit button on the form.
Use ajaxSubmit if you want to bind your own submit handler to the form.
````javascript
// bind submit handler to form
$('form').on('submit', function(e) {
e.preventDefault(); // prevent native submit
$(this).ajaxSubmit({
target: 'myResultsDiv'
})
});
````
---
##Options
Note: all standard [$.ajax](http://api.jquery.com/jQuery.ajax) options can be used.
###beforeSerialize
Callback function invoked prior to form serialization. Provides an opportunity to manipulate the form before its values are retrieved. Returning `false` from the callback will prevent the form from being submitted. The callback is invoked with two arguments: the jQuery wrapped form object and the options object.
````javascript
beforeSerialize: function($form, options) {
// return false to cancel submit
}
````
###beforeSubmit
Callback function invoked prior to form submission. This provides an opportunity to manipulate the form before it's values are retrieved. Returning `false` from the callback will prevent the form from being submitted. The callback is invoked with three arguments: the form data in array format, the jQuery wrapped form object, and the options Oobject.
````javascript
beforeSubmit: function(arr, $form, options) {
// form data array is an array of objects with name and value properties
// [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
// return false to cancel submit
}
````
###clearForm
Boolean flag indicating whether the form should be cleared if the submit is successful
###data
An object containing extra data that should be submitted along with the form.
````javascript
data: { key1: 'value1', key2: 'value2' }
````
###dataType
Expected data type of the response. One of: null, 'xml', 'script', or 'json'. The dataType option provides a means for specifying how the server response should be handled. This maps directly to jQuery's dataType method. The following values are supported:
* 'xml': server response is treated as XML and the 'success' callback method, if specified, will be passed the responseXML value
* 'json': server response will be evaluted and passed to the 'success' callback, if specified
* 'script': server response is evaluated in the global context
###delegation
true to enable support for event delegation
*requires jQuery v1.7+*
````javascript
// prepare all existing and future forms for ajax submission
$('form').ajaxForm({
delegation: true
});
````
###error
Callback function to be invoked upon error.
###forceSync
Only applicable when explicity using the iframe option or when uploading files on browses that don't support XHR2.
Set to `true` to remove the short delay before posting form when uploading files. The delay is used to allow the browser to render DOM updates prior to performing a native form submit. This improves usability when displaying notifications to the user, such as "Please Wait..."
###iframe
Boolean flag indicating whether the form should *always* target the server response to an iframe instead of leveraging XHR when possible.
###iframeSrc
String value that should be used for the iframe's src attribute when/if an iframe is used.
###iframeTarget
Identifies the iframe element to be used as the response target for file uploads. By default, the plugin will create a temporary iframe element to capture the response when uploading files. This options allows you to use an existing iframe if you wish. When using this option the plugin will make no attempt at handling the response from the server.
###replaceTarget
Optionally used along with the the target option. Set to true if the target should be replaced or false if only the target contents should be replaced.
###resetForm
Boolean flag indicating whether the form should be reset if the submit is successful
###semantic
Boolean flag indicating whether data must be submitted in strict semantic order (slower). Note that the normal form serialization is done in semantic order with the exception of input elements of `type="image"`. You should only set the semantic option to true if your server has strict semantic requirements and your form contains an input element of `type="image"`.
###success
Callback function to be invoked after the form has been submitted. If a `success` callback function is provided it is invoked after the response has been returned from the server. It is passed the following arguments:
1. responseText or responseXML value (depending on the value of the dataType option).
2. statusText
3. xhr (or the jQuery-wrapped form element if using jQuery < 1.4)
4. jQuery-wrapped form element (or undefined if using jQuery < 1.4)
###target
Identifies the element(s) in the page to be updated with the server response. This value may be specified as a jQuery selection string, a jQuery object, or a DOM element.
###type
The method in which the form data should be submitted, 'GET' or 'POST'.
###uploadProgress
Callback function to be invoked with upload progress information (if supported by the browser). The callback is passed the following arguments:
1. event; the browser event
2. position (integer)
3. total (integer)
4. percentComplete (integer)
###url
URL to which the form data will be submitted.
---
##Utility Methods
###formSerialize
Serializes the form into a query string. This method will return a string in the format: `name1=value1&name2=value2`
````javascript
var queryString = $('#myFormId').formSerialize();
````
###fieldSerialize
Serializes field elements into a query string. This is handy when you need to serialize only part of a form. This method will return a string in the format: `name1=value1&name2=value2`
````javascript
var queryString = $('#myFormId .specialFields').fieldSerialize();
````
###fieldValue
Returns the value(s) of the element(s) in the matched set in an array. This method always returns an array. If no valid value can be determined the array will be empty, otherwise it will contain one or more values.
###resetForm
Resets the form to its original state by invoking the form element's native DOM method.
###clearForm
Clears the form elements. This method emptys all of the text inputs, password inputs and textarea elements, clears the selection in any select elements, and unchecks all radio and checkbox inputs. It does *not* clear hidden field values.
###clearFields
Clears selected field elements. This is handy when you need to clear only
没有合适的资源?快使用搜索试试~ 我知道了~
礼品信封代发网程序系统源码+搭建教程+快递单号货源+充值软件
共1113个文件
js:313个
png:229个
gif:173个
1星 需积分: 50 48 下载量 46 浏览量
2018-09-19
03:52:46
上传
评论 6
收藏 8.79MB ZIP 举报
温馨提示
提供礼品网单号代发网里面含有搭建教程文件,可供新手使用)、提供快递资源(申通、圆通、龙邦、国通、韵达、百世、中通、天天、顺丰等等)单号货源 【如搭建不起来的可联系客服咨询如何搭建,或无法下载源码的也可联系免费获取源码,也有的人不懂搭建也可以联系客服使用我们的服务器免费为您免费搭建,】 (1)含空包单号批量导入导出功能 (2)含seo标优化设置 (3)后台会员管理功能 (4)空包单号数量预警系统 (5)客户下单功能、查询 (6)客户代理、提成模块 等等....... 微信账号:jike-ii 【可为你提供帮助】
资源推荐
资源详情
资源评论
收起资源包目录
礼品信封代发网程序系统源码+搭建教程+快递单号货源+充值软件 (1113个子文件)
Global.asax 99B
config.ascx 7KB
checkLoginCode.ashx 108B
checkalpCode.ashx 104B
checkCftCode.ashx 104B
PageAjax.ashx 102B
checkRegCode.ashx 101B
autoCz.ashx 98B
admin.ashx 96B
nologin.ashx 94B
shua.ashx 88B
SiteConfig.aspx 9KB
areaEdit.aspx 9KB
xhPrice.aspx 7KB
kddhPriceMana.aspx 7KB
navbar.aspx 6KB
flowPriceMana.aspx 6KB
citiesEdit.aspx 6KB
AreaMana.aspx 5KB
adMana.aspx 5KB
CzJl.aspx 5KB
kddhMana.aspx 5KB
links.aspx 5KB
AdminMana.aspx 4KB
kefuMana.aspx 4KB
flowType.aspx 4KB
xhzhMana.aspx 4KB
VipCard.aspx 4KB
flowMana.aspx 3KB
NewsMana.aspx 3KB
SiteInfoAll.aspx 3KB
CzFk.aspx 3KB
SiteInfo.aspx 3KB
UserMana.aspx 3KB
AutoCzMana.aspx 3KB
uploadMana.aspx 3KB
cashRecord.aspx 3KB
login.aspx 3KB
rpMana.aspx 2KB
UserJiangli.aspx 2KB
CZJiangLi.aspx 2KB
NewsEdit.aspx 2KB
NewsClass.aspx 2KB
UserEdit.aspx 2KB
siteContEdit.aspx 2KB
xhCont.aspx 1KB
KdCont.aspx 1KB
flowCont.aspx 1KB
UserRP.aspx 1KB
siteCont.aspx 1KB
VipCardEdit.aspx 1KB
uploadEdit.aspx 1KB
AutoCz.aspx 1KB
NewsClassEdit.aspx 1KB
UserAdd.aspx 876B
connector.aspx 871B
memberPw.aspx 801B
default.css.bak 2KB
_f.cfs 269B
_0.cfs 269B
_b.cfs 269B
_e.cfs 269B
_d.cfs 269B
_1.cfs 269B
_c.cfs 269B
Web.config 7KB
Web.config 3KB
packages.config 1KB
BuyKd.cshtml 19KB
Pay.cshtml 14KB
BuyFlow.cshtml 8KB
BuyCollect.cshtml 8KB
TG.cshtml 8KB
Kddh.cshtml 7KB
CashRecord.cshtml 6KB
Flow.cshtml 6KB
Collect.cshtml 6KB
Address_Edit.cshtml 6KB
Address.cshtml 6KB
BandUser.cshtml 5KB
AutoCz.cshtml 5KB
Index.cshtml 5KB
Index.cshtml 5KB
UpVip.cshtml 4KB
Index.cshtml 3KB
EditPwd.cshtml 3KB
Top.cshtml 3KB
BandQQ.cshtml 3KB
LoginQQ.cshtml 2KB
List.cshtml 2KB
LoginBox.cshtml 2KB
Index.cshtml 2KB
Invite.cshtml 2KB
Quick_nav.cshtml 2KB
Kefu.cshtml 1KB
Footer.cshtml 1KB
Left.cshtml 1KB
_LayoutMaster.cshtml 992B
InFo.cshtml 735B
Index.cshtml 678B
共 1113 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
资源评论
- weixin_446231852019-01-26垃圾不能用的
Jike-ii
- 粉丝: 2
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功