2013-05-02 112 views
1

以下代码给出了DOJO未定义错误,而我在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'; 

回答

0

IE的哪个版本?

This fiddle适用于IE9。你确定replace元素存在于你的DOM吗?

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正确加载。

结果:

enter image description here

+0

** IE VERSION 8 ** – pratik 2013-05-02 11:31:33

+0

它也适用于IE8。 – 2013-05-02 11:34:31

+0

**我不,但它不能在IE8 ** – pratik 2013-05-02 11:36:55