Note that there are some explanatory texts on larger screens.

plurals
  1. POLoad Dojo from CDN using jQuery
    primarykey
    data
    text
    <p>Here is the example that I took from the <a href="http://dojotoolkit.org/documentation/tutorials/1.8/dojo_config/" rel="nofollow">article</a> and a bit changed. This example perfectly works</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dijit/themes/claro/claro.css" media="screen"&gt; &lt;script type="text/javascript"&gt; dojoConfig = { parseOnLoad: false, async: true }; &lt;/script&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojo/dojo.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; /// Require the registry, parser, Dialog, and wait for domReady require(["dijit/registry", "dojo/parser", "dojo/json", "dojo/_base/config", "dijit/Dialog"], function (registry, parser, JSON, config) { // Explicitly parse the page parser.parse(); // Find the dialog var dialog = registry.byId("dialog"); // Set the content equal to what dojo.config is dialog.set("content", "&lt;b&gt;it works!&lt;/b&gt;"); // Show the dialog dialog.show(); }); &lt;/script&gt; &lt;/head&gt; &lt;body class="claro"&gt; &lt;div id="dialog" data-dojo-type="dijit.Dialog"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>now I want to modify it and load Dojo dynamically using jQuery. Here is the example how I do this:</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dijit/themes/claro/claro.css" media="screen"&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { dojoConfig = { parseOnLoad: false, async: true }; $.getScript("http://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojo/dojo.js") .done(function (script, textStatus) { /// Require the registry, parser, Dialog, and wait for domReady require(["dijit/registry", "dojo/parser", "dojo/json", "dojo/_base/config", "dijit/Dialog"], function (registry, parser, JSON, config) { // Explicitly parse the page parser.parse(); // Find the dialog var dialog = registry.byId("dialog"); // Set the content equal to what dojo.config is dialog.set("content", "&lt;b&gt;it works!&lt;/b&gt;"); // Show the dialog dialog.show(); }); }) .fail(function (jqxhr, settings, exception) { alert('Cannot load Dojo.js'); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body class="claro"&gt; &lt;div id="dialog" data-dojo-type="dijit.Dialog"&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>but looks like I do something wrong cause it raises the next error </p> <pre><code>NotFoundError: Node was not found http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js Line 2 </code></pre> <p>I suspect that Dojo is not ready yet but maybe I'm wrong... Is it possible to use jQuery to load Dojo dynamically at all?</p>
    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.
 

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