加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Use Dojo to Replace PrototypeJS codes

发布时间:2020-12-16 21:38:05 所属栏目:百科 来源:网络整理
导读:1.Old PrototypeJS Script: 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=TRUEGREEN_NAV=TRUE");new Ajax.Request(url,{metho

1.Old PrototypeJS Script:

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;
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() {
			
            }
        });         
});

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读