the compact javascript framework
in partnership with mediatemple
Contains the Ajax class. Also contains methods to generate querystings from forms and Objects.
Loosely based on the version from prototype.js http://prototype.conio.net
MIT-style license.
Ajax.js | Contains the Ajax class. |
Ajax | An Ajax class, For all your asynchronous needs. |
Properties | |
request | Executes the ajax request. |
evalScripts | Executes scripts in the response text |
getHeader | Returns the given response header or null |
Object related Functions | |
Functions | |
Object. toQueryString | Generates a querystring from key/pair values in an object |
Element | Custom class to allow all of its methods to be used with any DOM element via the dollar function $. |
Properties | |
send | Sends a form with an ajax post request |
An Ajax class, For all your asynchronous needs. Inherits methods, properties, options and events from XHR.
url | the url pointing to the server-side script. |
options | optional, an object containing options. |
data | you can write parameters here. Can be a querystring, an object or a Form element. |
update | $(element) to insert the response text of the XHR into, upon completion of the request. |
evalScripts | boolean; default is false. Execute scripts in the response text onComplete. When the response is javascript the whole response is evaluated. |
evalResponse | boolean; default is false. Force global evalulation of the whole response, no matter what content-type it is. |
onComplete | function to execute when the ajax request completes. |
var myAjax = new Ajax(url, {method: 'get'}).request();
Properties | |
request | Executes the ajax request. |
evalScripts | Executes scripts in the response text |
getHeader | Returns the given response header or null |
Executes the ajax request.
var myAjax = new Ajax(url, {method: 'get'}); myAjax.request();
OR
new Ajax(url, {method: 'get'}).request();
Functions | |
Object. toQueryString | Generates a querystring from key/pair values in an object |
Generates a querystring from key/pair values in an object
source | the object to generate the querystring from. |
the query string.
Object.toQueryString({apple: "red", lemon: "yellow"}); //returns "apple=red&lemon=yellow"
Custom class to allow all of its methods to be used with any DOM element via the dollar function $.
Properties | |
send | Sends a form with an ajax post request |
Sends a form with an ajax post request
options | option collection for ajax request. See Ajax for the options list. |
The Ajax Class Instance
<form id="myForm" action="submit.php"> <input id="email" value="bob@bob.com"> <input id="zipCode" value="90210"> </form> <script> $('myForm').send() </script>
Generates a querystring from key/pair values in an object
returns the element passed in with all the Element prototypes applied.
Documentation by Aaron Newton & Mootools Developers, generated by NaturalDocs and GeSHi