Acme.BookStore.HttpApi.Host/node_modules/jquery-form/docs/options.md

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

---
---

## ajaxForm and ajaxSubmit Options
Both `ajaxForm` and `ajaxSubmit` support numerous options which can be provided using plain JavaScript `options` object containing any of the options below:  
**Note:** Aside from the options listed below, you can also pass any of the standard [$.ajax settings](https://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings) to ajaxForm and ajaxSubmit.


### beforeSerialize
Default: `null`  
Callback function to be invoked before the form is serialized. This provides an opportunity to manipulate the form before it's values are retrieved. The `beforeSerialize` function is invoked with two arguments: the jQuery object for the form, and the Options Object passed into ajaxForm/ajaxSubmit.

```javascript
beforeSerialize: function($form, options) {
  // return false to cancel submit
}
```


### beforeSubmit
Default: `null`  
Callback function to be invoked before the form is submitted. The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for validating the form data. If the 'beforeSubmit' callback returns false then the form will not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data in array format, the jQuery object for the form, and the Options Object passed into ajaxForm/ajaxSubmit.

```javascript
beforeSubmit: function(arr, $form, options) {
  // The array of form data takes the following form:
  // [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]

  // return false to cancel submit
}
```


### clearForm
Default: `null`  
Boolean flag indicating whether the form should be cleared if the submit is successful


### data
Default: `{}`  
An object containing extra data that should be submitted along with the form.  

```javascript
data: { key1: 'value1', key2: 'value2' }
```


### dataType
Default: `null`  
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 the `jQuery.httpData` method. The following values are supported:

**'xml'**: if dataType == 'xml' the server response is treated as XML and the 'success' callback method, if specified, will be passed the responseXML value

**'json'**: if dataType == 'json' the server response will be evaluted and passed to the 'success' callback, if specified

**'script'**: if dataType == 'script' the server response is evaluated in the global context


### error
**Deprecated** due to incompatiblity with jQuery 3 Slim. ([issue #544](https://github.com/jquery-form/form/issues/544))  
后面还有 95 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。