【发布时间】:2010-11-05 19:03:20
【问题描述】:
你必须将args变量传递给匿名函数,但是匿名函数显然不需要args变量,所以你必须记住Dojo什么时候需要args变量,但是Dojo帮助页面没有说!那么,Dojo 什么时候需要 args 变量呢?
var init = function(){
var contentNode = dojo.byId("content");
dojo.xhrGet({
url: "js/sample.txt",
handleAs: "text",
load: function(data,args){
// fade out the node we're modifying
dojo.fadeOut({
node: contentNode,
onEnd: function(){
// set the data, fade it back in
contentNode.innerHTML = data;
dojo.fadeIn({ node: contentNode }).play();
}
}).play();
},
// if any error occurs, it goes here:
error: function(error,args){
console.warn("error!",error);
}
});
};
dojo.addOnLoad(init);
【问题讨论】:
-
你必须更加明确。粘贴一些代码。
-
我粘贴了一些代码。我想知道它是否会起作用。
标签: javascript ajax frameworks dojo