More about jQuery AJAX

Posted by Alaa Badran in Uncategorized. 8 comments

13th October

jQuery made AJAX simple by using .ajax() function.
The syntax for this function is:

$.ajax( /* properties */);

Now let me explain what properties we can use in this function.

First, I would like to tell you what basic (standard) options for .ajax() as follow:
– url: String /* The URL to send the request to */
– type: String /* The request type (“GET”, “POST”) */
– contentType: String /* default: “application/x-www-form-urlencoded” */
– data: Object, String /* Data to be sent to the server. It is converted to a query string, if not already a string. It’s appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key i.e. {foo:[“bar1”, “bar2”]} becomes ‘&foo=bar1&foo=bar2’ */

– beforeSend: Function /* This function runs just before sending the request */
– … Read More »