Starting with Dojo (AMD)
Small Dojo "Hello World" with require(...) / AMD capability
by b_long
HTML
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.8.1/dojo/dojo.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8.1/dojo/resources/dojo.css">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8.1/dijit/themes/claro/claro.css">
<!-- note that you can always create a dojoConfig object instead of putting
everything into data-dojo-config if you want -->
<div class="claro">
<h1>Demo: Custom Modules with CDN</h1>
<p id="greeting"/>
<br/>
</div>
JavaScript
// load our custom/Hello module and wait for the DOM to be ready
require(["dojo/domReady!", "dojo/parser", "dijit/Dialog"], function (parser) {
// create our custom dialog
var w = new dijit.Dialog({
id: "greeting",
content: "Hello World!"
// place it in the DOM
}).placeAt(document.body);
// show it
w.show();
});