Hi guys,I'm trying to build a new web map with javascript class, but it seems that dojo.require doesn't work well with javascript class.Here is my index.html code:<html>
<head>
<!-- TITRE -->
<title>Cartographie 2.0</title>
<!-- FORMATAGE -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- DOCTYPE -->
<!DOCTYPE html>
<!-- XHTML -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!-- CSS -->
<link rel="stylesheet" href="css/interface.css" type="text/css">
<!-- JAVASCRIPT -->
<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/"></script>
<script type="text/javascript" src="js/jquery-1.9.1.min.js" ></script>
<script type="text/javascript" src="js/jquery-ui-1.10.1.custom.min.js" ></script>
<script type="text/javascript" src="js/mapper.js" ></script>
<script type="text/javascript">
var oMapper = new Mapper();
$(document).ready(function()
{
oMapper.init();
console.dir(initMap());
});
</script>
</head>
<body>
<div id="main" class="container">
</div>
</body>
</html>
and there is my javascript class:
dojo.require("esri.map");
/*
* Objet Mapper
*/
function Mapper()
{
// public variables
this.map;
// private variables
// public functions
this.init = init;
this.initMap = initMap;
this.buildDivs = buildDivs;
function init()
{
console.log("init");
buildDivs();
dojo.ready(initMap());
}
function initMap()
{
this.map = new esri.Map("map",{
basemap:"topo",
center:[-122.45,37.75], //long, lat
zoom:13,
sliderStyle:"small"
});
}
function buildDivs()
{
div_main = $('#main');
div_map = $('<div id="map"></div>');
div_main.append(div_map);
}
}
When my app is called, the init is called, but when entering the function dojo.ready(initMap()); FireBug gives me a ReferenceError: esri is not defined (this.map = new esri.Map("map",{.....)How can I make this work?Thank you