Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The easiest solution would be simply nesting the calls. Scroll down for a clean and readable solution.</p> <pre><code>function _process(r) { $.each(make_all_titles3(r), function (i, v) { $vpl.append(v); }); } $.getJSON('http://localhost/search_data.php?title=' + title + '&amp;run=annotations&amp;jsoncallback=?', function (r) { _process(r); $.getJSON('http://localhost/search_data.php?title=' + title + '&amp;run=Link&amp;jsoncallback=?', function (r) { _process(r); $.getJSON('http://localhost/search_data.php?title=' + title + '&amp;user=' + user + '&amp;run=bookmarks&amp;jsoncallback=?', function (r) { _process(r); $vpl.append('&lt;div&gt;Related Terms&lt;/div&gt;'); $.getJSON('http://localhost/context-search.php?title=' + title + '&amp;jsoncallback=?', function (r) { _process(r); }); }); }); }); </code></pre> <p>Now the clean and readable one, using the <a href="https://github.com/caolan/async" rel="nofollow"><code>async</code></a> library:</p> <pre><code>var load = [ { url: 'http://localhost/search_data.php?title=' + title + '&amp;run=annotations&amp;jsoncallback=?', before: null }, { url: 'http://localhost/search_data.php?title=' + title + '&amp;run=Link&amp;jsoncallback=?', before: null }, { url: 'http://localhost/search_data.php?title=' + title + '&amp;user=' + user + '&amp;run=bookmarks&amp;jsoncallback=?', before: null }, { url: 'http://localhost/context-search.php?title=' + title + '&amp;jsoncallback=?', before: function() { $vpl.append('&lt;div&gt;Related Terms&lt;/div&gt;'); } } ]; async.forEachSeries(load, function(item, next) { if(item.before) { item.before(); } $.getJSON(item.url, function(r) { $.each(make_all_titles3(r), function (i, v) { $vpl.append(v); }); next(); }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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