An open API service indexing awesome lists of open source software.

https://github.com/b13/js-form

Module to submit a form via ajax and do a basic validation
https://github.com/b13/js-form

Last synced: 9 months ago
JSON representation

Module to submit a form via ajax and do a basic validation

Awesome Lists containing this project

README

          

js-form
=======

Module to submit forms via ajax and do a basic form validation

# requireJS config

```js
var require = {
paths: {
'form' : 'path/to/form'
}
};
```

# Basic usage

```js
require(['form'], function(form) {

var formUtilities = new form();

// check if the form is valid
formUtilities.validateForm($form);

// submit form via ajax and return response as jquery promise
formUtilities.submitFormViaAjax($form, {urlParams: 'ajax=1'}).done(function(response) {
// use response from ajax request
});

// submit form with a attachment via ajax and return the response as jquery promise
formUtilities.submitFormWithAttachmentViaAjax($form, {urlParams: 'ajax=1'}).done(function(response) {
// use response from ajax request
});
});

```