What is the difference between jQuery.get() and jQuery.ajax() ?

jQuery QuestionsCategory: GeneralWhat is the difference between jQuery.get() and jQuery.ajax() ?
Manda asked 2 years ago
1 Answers
Joe Mendoza Staff answered 2 years ago

Of the two calls – $.ajax() is the most configurable. You get fine grained control over HTTP headers and you also get direct access to the XHR-object. Slightly better error-handling is also provided but you have to deal with the returned data yourself using a callback.

$.get() is a shorthand for $.ajax() – when using jQuery.get() you pass in an object, and not arguments. The minimum required arguments are the URL of the file you want to retrieve (i.e. ‘test.txt’) and a success callback.

Pin It on Pinterest