Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2016-03-24 (7 months ago) | | Not enough user ratings | | Total: 94 | | All time: 389 This week: 46 |
|
Collaborate with this project | | Author |
Description This is a simple object that can make form be submitted via AJAX using jQuery.
It adds an event handler to all form elements on a page to handle the submit event so the form values are submitted using AJAX requests.
The forms can define additional attributes to specify the code to be executed when the before the form is submitted, after is submitted and the response is retrieved.
Other attributes are retrieved from the form element to use during the AJAX request like the action URL and encoding type. | |
|
Details
auto-ajax-form
Form that is submited via ajax call without the programmer having to code the entire ajax request.
Example:
<form id='ajax-form' ajax="true" action="ajax-call.php" type="POST" success="callback(data)" complete="callback2(data)">
<input name="input1" type="text" />
<input name="file1" type="file" />
<button type="submit" >Submit</button>
</form>
<script>
var callback = function(data){
console.log(data);
}
var callback2 = function(data){
console.log('second callback');
}
</script>
Code explained:
- Each form has to have an individual id ( currently working on removing this feature ).
- If ajax="true" it will send the request via ajax
- Code injections: Currently you can inject success="function(data)" (runs a function with the data of the ajax call ), complete="function(data)"
Sugestions and improvements:
- Feel free to talk to me in pihh.rocks@gmail.com for any sugestion or improvement.
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.