i have a javascript function inside the dojo.requires function:
for instance:
require(["esri/map"], function(Map) { function switchService(servicename) { alert("hello world"); } function listServices() { var html = ""; var results = // list of services returned from json file //loops thru list for (var i=0; i<results.length-1; i++) { html += '<input checked name="radioService" id="chk_' + serviceName + '" style="margin-left: 15px;" type="radio" value="' + serviceName + "|" + results + '" onclick="switchServices(this.value);" />'; } document.getElementById('divMapServices').innerHTML = html; } }
everything works great once i move the switchService function outside of the dojo requires function. However after switching services, i am rebuilding the layers list for the new service and which is located back inside the requires function. thus i cannot accees the buildlayers function since my scope is now outside the requires function... hope that makes sense... lol
i've been reading up on dojo and modules... so i might rewrite everything to go that route... however, if anyone has a solution, please let me know