Use Dojo to Replace PrototypeJS codes
1.Old PrototypeJS Script:
[javascript]
var loc = document.location.pathname;
var tail = "webengine/generated/Init"
loc = loc.substr(0,loc.indexOf(tail));
var url = loc.concat("protect/RouterServlet?NAV_MENU=TRUE&GREEN_NAV=TRUE");
new Ajax.Request(url,{method:'get', onSuccess:function(request){
var elemAjxResp = request.responseText;
document.getElementById('com-navigation').innerHTML = elemAjxResp;;
}});
2. Use Dojo Ajax and dom operation;
[javascript] www.zzzyk.com
require(["dojo/_base/xhr", "dojo/dom", "dojo/domReady!"],
function(xhr, dom) {
xhr.get({
url: url,
load: function(newContent) {
dom.byId("com-navigation").innerHTML = newContent;
},
error: function() {
}
});
});
补充:web前端 , JavaScript ,