Ajax methods

We can retrieve information from the server without requiring a page refresh by calling one of these Ajax methods. Ajax methods are discussed in detail in Chapter 6, Sending Data with Ajax.

Issuing requests

Ajax method

Description

$.ajax([url], options)

Makes an Ajax request using the provided set of options. This is a low-level method that is often called via other convenience methods.

.load(url, [data], [callback])

Makes an Ajax request to url and places the response into the matched elements.

$.get(url, [data], [callback], [returnType])

Makes an Ajax request to url using the GET method.

$.getJSON(url, [data], [callback])

Makes an Ajax request to url, interpreting the response as a JSON data structure.

$.getScript(url, ...

Get Learning jQuery - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.