jQuery.get() Function

By: Dusty Arlia
Published on Saturday, December 7, 2013, 02:33 PM
Last Updated on Saturday, July 11, 2015 at 9:06 PM
Total Updates: 2

Both the jQuery.get() and jQuery.post() functions will fetch the contents of a URL. Here is the basic syntax:

jQuery.get([url], [data], [success(data, textStatus, jqXHR)], [dataType])

The url argument is a string. It provides the URL where the request is sent.

The data argument is a PlainObject or a string. It is sent to the server with the HTTP GET request.

The success(data, textStatus, jqXHR) argument is a callback function that is executed if the request succeeds. It is required if dataType is provided, but can be null in that case.

The dataType argument is a string that indicates the type of data expected from the server. The default is Intelligent Guess (options: xml, json, script, text, html).