Skip to content

Commit 440eb3c

Browse files
committed
- Prefer const and shorthand in docs
1 parent 12e04ab commit 440eb3c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ The jqXHR object is stored in element <em>data</em>-cache with the <code>jqxhr</
4747
call. It can be accessed like this:
4848

4949
````javascript
50-
var form = $('#myForm').ajaxSubmit({ /* options */ });
51-
var xhr = form.data('jqxhr');
50+
const form = $('#myForm').ajaxSubmit({ /* options */ });
51+
const xhr = form.data('jqxhr');
5252

5353
xhr.done(function() {
5454
...
@@ -89,7 +89,7 @@ $('form').on('submit', function(e) {
8989
Callback function invoked before 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.
9090

9191
````javascript
92-
beforeSerialize: function($form, options) {
92+
beforeSerialize ($form, options) {
9393
// return false to cancel submit
9494
}
9595
````
@@ -98,7 +98,7 @@ beforeSerialize: function($form, options) {
9898
Callback function invoked before form submission. 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 object.
9999

100100
````javascript
101-
beforeSubmit: function(arr, $form, options) {
101+
beforeSubmit (arr, $form, options) {
102102
// form data array is an array of objects with name and value properties
103103
// [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
104104
// return false to cancel submit
@@ -109,7 +109,7 @@ beforeSubmit: function(arr, $form, options) {
109109
Callback function invoked before form events unbind and bind again. Provides an opportunity to manipulate the form before events will be remounted. The callback is invoked with two arguments: the jQuery wrapped form object and the options object.
110110

111111
````javascript
112-
beforeFormUnbind: function($form, options) {
112+
beforeFormUnbind ($form, options) {
113113
// your callback code
114114
}
115115
````
@@ -118,7 +118,7 @@ beforeFormUnbind: function($form, options) {
118118
Callback function invoked before processing fields. This provides a way to filter elements.
119119

120120
````javascript
121-
filtering: function(el, index) {
121+
filtering (el, index) {
122122
if ( !$(el).hasClass('ignore') ) {
123123
return el;
124124
}
@@ -216,14 +216,14 @@ URL to which the form data will be submitted.
216216
Serializes the form into a query string. This method will return a string in the format: `name1=value1&name2=value2`
217217

218218
````javascript
219-
var queryString = $('#myFormId').formSerialize();
219+
const queryString = $('#myFormId').formSerialize();
220220
````
221221

222222
### fieldSerialize
223223
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`
224224

225225
````javascript
226-
var queryString = $('#myFormId .specialFields').fieldSerialize();
226+
const queryString = $('#myFormId .specialFields').fieldSerialize();
227227
````
228228

229229
### fieldValue

0 commit comments

Comments
 (0)