Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Append <code>&amp;callback=?</code> to the URL.</p> <pre><code>$.getJSON('http://graph.facebook.com/?ids=http://legrandj.eu/article/blouse_ghost_dream&amp;callback=?', function(data) { // .. }); // Or (more clean): $.getJSON('http://graph.facebook.com/?callback=?', { ids: 'http://legrandj.eu/article/blouse_ghost_dream' }, function(data) { // ... } ); </code></pre> <p>Given this code, jQuery creates and inserts a <code>&lt;script src="http://graph.facebook.com/?ids=http://legrandj.eu/article/blouse_ghost_dream&amp;callback=jQuery171022388557461090386_1332329918803&amp;_=133232991983"&gt;</code>. Explanation of the URL:</p> <ul> <li>Base URL: <a href="http://graph.facebook.com/?ids=http://legrandj.eu/article/blouse_ghost_dream" rel="nofollow">http://graph.facebook.com/?ids=http://legrandj.eu/article/blouse_ghost_dream</a></li> <li>Callback handler: <code>&amp;callback=jQuery171022388557461090386_1332329918803</code><br> <strong>jQuery replaces <code>?</code> in <code>callback=?</code> with an unique temporary identifier</strong>.</li> <li>Cache-breaking: <code>&amp;_=133232991983</code></li> </ul> <p>The FB API returns a response in the following format (<a href="http://en.wikipedia.org/wiki/JSONP" rel="nofollow">JSONP</a>):</p> <pre><code>/**/ jQuery171022388557461090386_1332329918803({ "http://legrandj.eu/article/blouse_ghost_dream": { "id": "http://legrandj.eu/article/blouse_ghost_dream", "shares": 3 } }); </code></pre> <p>Since this is included by the <code>&lt;script&gt;</code> tag, a function <code>jQuery171022388557461090386_1332329918803</code> is called, passing the parsed JSON as an argument. The parsed JSON is then passed to the function which you defined in <code>jQuery.getJSON</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload