Load JSON data using an HTTP GET request.
As of jQuery 1.2, you can load JSON data located on another domain if you specify a JSONP callback.
The callback takes the form "example.com?callback=?". jQuery automatically replaces the '?' with a random method name that doesn't clash with the global scope. You do not have to specify the method name yourself.
Note that the site you're trying to call needs to support JSON-P output. The callback parameter might vary depending on the API, for instance Yahoo Pipes requires "_callback=?"
Keep in mind, that lines after this function will be executed before the callback.Arguments:
| url | String | |
|---|---|---|
| The URL of the page to load. | ||
| data (Optional) | Map | |
| Key/value pairs that will be sent to the server. | ||
| callback (Optional) | Function | |
A function to be executed whenever the data is loaded successfully.
function (data, textStatus) {
// data will be a jsonObj
// textStatus will be "success"
this; // the options for this ajax request
}
| ||