当我在 Internet Explorer 中运行以下代码时,出现 DOJO 未定义错误。
<script language="text/javascript" src="dojoroot/dojo/dojo.js"
djConfig="parseOnLoad: true,isDebug:false" ></script>
<script type="text/javascript">
function readFile() {
dojo.xhrGet({
url: "http://www.jnerlich.de/servlets/ReturnParameters",
handleAs: "text",
timeout: 5000,
load: function(response, ioArgs) {
dojo.byId("replace").innerHTML = response;
return response;
},
error: function(response, ioArgs) {
console.error("HTTP status code: ", ioArgs.xhr.status);
dojo.byId("replace").innerHTML = 'Loading the ressource from the server did not work';
return response;
},
content: {name: "lars", url:"testing" }
});
}
</script>
错误 我现在正在这一点
dojo.byId("replace").innerHTML = 'Loading the ressource from the server did not work';
最佳答案
哪个版本的 IE?
This fiddle适用于 IE9。您确定 DOM 中存在 replace
元素吗?
function readFile() {
var content = {
name: "lars",
url: "testing"
};
dojo.xhrPost({
url: "/echo/html/",
handleAs: "text",
timeout: 5000,
load: function (response, ioArgs) {
console.log("load", arguments);
dojo.byId("replace").innerHTML = response;
return response;
},
error: function (response, ioArgs) {
console.log("error", arguments);
console.error("HTTP status code: ", ioArgs.xhr.status);
dojo.byId("replace").innerHTML = 'Loading the ressource from the server did not work';
return response;
},
content: {
html: JSON.stringify(content)
}
});
}
编辑 - 对于 IE,您可能需要在 full screen mode 中查看,因为常规 jsfiddle 页面在 IE8 中无法正确加载。
结果:
关于javascript - DOJO 未定义错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16334865/