jQuery Tutorial
jQuery Introduction jQuery Getting Started jQuery Syntax jQuery Selectors jQuery Events
jQuery Effects
jQuery Hide/Show jQuery Fade jQuery Slide jQuery Animation jQuery stop() jQuery Callback jQuery Chaining
jQuery Manipulation
jQuery Get/Set jQuery Add jQuery Remove jQuery CSS Classes jQuery css() jQuery Dimensions
jQuery Traversing
jQuery Traversing jQuery Ancestors jQuery Descendants jQuery Siblings jQuery Filtering
jQuery AJAX
jQuery AJAX Intro jQuery Load jQuery Get/Post jQuery AJAX Events
jQuery Misc
jQuery noConflict() jQuery Filters
jQuery References
jQuery Reference jQuery Selectors jQuery Events jQuery Effects jQuery HTML/CSS jQuery Traversing jQuery AJAX jQuery Miscellaneous jQuery Properties

jQuery AJAX Reference

AJAX allows web pages to be updated "asynchronously" by exchanging data with a web server behind the scenes.

This means that it is possible to update parts of a web page, without reloading the whole page.

The jQuery library has a full suite of Ajax capabilities.

The functions and methods therein allow us to load data from the server without a browser page refresh.


Global Ajax Event Handlers

These methods attaches a function to be called when certain Ajax events, such as initialization or completion, take place for any Ajax request on the page:

Method Description
ajaxComplete() Attach a function to be called when Ajax requests complete. This is an AjaxEvent
ajaxError() Attach a function to be called when Ajax requests complete with an error. This is an Ajax Event
ajaxSend() Attach a function to be called before an Ajax request is sent. This is an Ajax Event
ajaxStart() Attach a function to be called when the first Ajax request begins. This is an Ajax Event
ajaxStop() Attach a function to be called when all Ajax requests have completed. This is an Ajax Event
ajaxSuccess() Attach a function to be called whenever an Ajax request completes successfully. This is an Ajax Event

Helper Functions

These functions assist with common idioms encountered when performing Ajax tasks:

Method Description
$.param() Creates a serialized representation of an array or object (can be used as URL query string for AJAX requests)
serialize() Encodes a set of form elements as a string for submission
serializeArray() Encodes a set of form elements as an array of names and values

Low-Level Interface

These methods can be used to make arbitrary Ajax requests:

Method Description
$.ajax() Performs an async HTTP (AJAX) request
$.ajaxPrefilter() Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax()
$.ajaxSetup() Sets the default values for future AJAX requests. Its use is not recommended
$.ajaxTransport() Creates an object that handles the actual transmission of Ajax data

Shorthand Methods

These methods perform the more common types of Ajax requests in less code:

Method Description
$.get() Loads data from a server using a HTTP GET request
$.getJSON() Loads JSON-encoded data from a server using a GET HTTP request
$.getScript() Loads (and executes) a JavaScript file from a server using an GET HTTP request
$.post() Loads data from a server using a HTTP POST request
load() Load data from the server and place the returned HTML into the selected elements