Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://jquery.com/" rel="nofollow">jQuery</a> can actualy do this through <a href="http://api.jquery.com/category/deferred-object/" rel="nofollow">promises</a>. It's just a matter of modifying the code.</p> <p>Assuming that you own the code and all live <a href="http://en.wikipedia.org/wiki/Same_origin_policy" rel="nofollow">in the same domain</a> or if cross-domain, the server <a href="http://en.wikipedia.org/wiki/Cross-origin_resource_sharing" rel="nofollow">allows CORS</a>, we will load each with <a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow"><code>.ajax()</code></a>. We will then use <a href="http://api.jquery.com/jQuery.when/" rel="nofollow"><code>.when()</code></a> to detect when all the promises are loaded and <a href="http://api.jquery.com/deferred.then/" rel="nofollow"><code>.then()</code></a> to add our callback to execute all the promises resolve.</p> <pre><code>//you can provide a detailed setting for each using .ajax()'s second parameter //however, jQuery can "smart detect" the content's dataType var chart = $.ajax(urlOfChart), //script theme = $.ajax(urlOfTheme), //css data = $.ajax(urlOfData); //JSON //we use .when() to check when all three resolves //the arguments will be the jqXHR objects for the requests //in the order they were given in the argument list $.when(chart,theme,data).then(function(chart,theme,data){ //according to jQuery.ajax(), if a script is requested, it is evaluated //and we still get it's plain text content //so with respect to the script, we do no processing //with the css, we get it as plain text since no dataType value handles it //we embed it into the DOM by creating a style element //and append the text in it for the styles to take effect on the page $('&lt;style type="text/css" /&gt;').html(theme).appendTo('head'); //as for the JSON, jQuery converts it into an object //and is passed as an argument as the return data for that promise //...everything is now requested, retrieved and prepared... //everything else goes under here }); </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.
    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