The $.ajax() Method

JQuery also has an $.ajax() method that could be used instead of $.getJSON().

The $.ajax() method can be used to perform an asynchronous HTTP (Ajax) request. The difference is that $.ajax() is not just for JSON requests, it can be used for other types of requests, such as XML, scripts, HTML, and even plain text requests.

The way it works is like this:

The $.ajax() method has a lot of options available for customizing your HTTP request. These are all explained in the JQuery API documentation.