<pclass="arguement"><strong>url</strong>A string containing the URL to which the request is sent.</p>
<pclass="arguement"><strong>data</strong>A map or string that is sent to the server with the request.</p>
<pclass="arguement"><strong>callback(data, textStatus)</strong>A callback function that is executed if the request succeeds.</p>
</li></ul>
<divclass="longdesc">
<p>This is a shorthand Ajax function, which is equivalent to:</p>
<pre>$.ajax({
url: <em>url</em>,
dataType: 'json',
data: <em>data</em>,
success: <em>success</em>
});
</pre>
<p>The callback is passed the returned data, which will be a JavaScript object or array as defined by the JSON structure and parsed using the <code><ahref="/jQuery.parseJSON">$.parseJSON()</a></code> method.</p>
<p><strong>Note:</strong> For details on the JSON format, see <ahref="http://json.org/">http://json.org/</a>.</p>
<p>Most implementations will specify a success handler:</p>
<p>This example, of course, relies on the structure of the JSON file:</p>
<pre>{
"foo": "The quick brown fox jumps over the lazy dog.",
"bar": "ABCDEFG",
"baz": [52, 97]
}
</pre>
<p>Using this structure, the example inserts the first string and second number from the file onto the page.</p>
<p>If there is a syntax error in the JSON file, the request will usually fail silently. Avoid frequent hand-editing of JSON data for this reason.</p>
<p>If the specified URL is on a remote server, the request is treated as JSONP instead. See the discussion of the <code>jsonp</code> data type in <code><ahref="/jQuery.ajax">$.ajax()</a></code> for more details.</p>
</div>
<h3>Examples:</h3>
<divid="entry-examples"class="entry-examples">
<divid="example-0">
<h4>Example: <spanclass="desc">Loads the four most recent cat pictures from the Flickr JSONP API.</span>