1

当我在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'; 
4

1 回答 1

0

哪个版本的IE?

这个小提琴在 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,您可能需要以全屏模式查看,因为常规 jsfiddle 页面无法在 IE8 中正确加载。

结果:

在此处输入图像描述

于 2013-05-02T11:29:42.297 回答