IE9 错误:SCRIPT5007:无法获取属性“ajax”的值:对象为空或未定义

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16809334/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 11:02:11  来源:igfitidea点击:

IE9 error: SCRIPT5007: Unable to get value of the property 'ajax': object is null or undefined

javascriptajaxinternet-explorerbackbone.js

提问by L. Sanna

My problem

我的问题

I'm trying to put a map on a webpage, the data being fetch with Ajax. It works fine with all browsers, but not IE9.

我正在尝试将地图放在网页上,正在使用 Ajax 获取数据。它适用于所有浏览器,但不适用于 IE9。

I get an error:

我收到一个错误:

SCRIPT5007: Unable to get value of the property 'ajax': object is null or undefined

SCRIPT5007:无法获取属性“ajax”的值:对象为空或未定义

and the map does not load.

并且地图未加载。

The code

编码

       var mapModel = new Map(); 

       mapModel.get("leads").fetch({success: function(){ //error on this line
              var mapView = new MapView({ model: mapModel });
              $('body').append(mapView.el);
              mapView.render();
           }});

What I tried

我试过的

This seems to be a very common issue, hereis the most up-voted question on the subject. So I tried to put

这似乎是一个非常普遍的问题,是有关该主题的投票最多的问题。所以我试着把

 <meta http-equiv="X-UA-Compatible" content="IE=8"/>

but it didn't solve anything.

但它没有解决任何问题。

My question

我的问题

What I should I do to fix this problem?

我应该怎么做才能解决这个问题?

回答by L. Sanna

OK, I found the problem:

好的,我发现了问题:

IE9 was rendering the page in compatibility mode.

IE9 正在以兼容模式呈现页面。

I added

我加了

<meta http-equiv="X-UA-Compatible" content="IE=edge" >

as the very first line of the header, and now it works.

作为标题的第一行,现在它可以工作了。

回答by Rajan Balamurugan

Finally I solved this issue.

最后我解决了这个问题。

In my master page, there was a script manager. I replaced it with ToolkitScriptManager which is actually packaged with AjaxControlToolkit 4.0.

在我的母版页中,有一个脚本管理器。我用 ToolkitScriptManager 替换了它,它实际上是与 AjaxControlToolkit 4.0 一起打包的。

Now it works superbly.

现在它工作得很好。

Hope this might help someone

希望这可以帮助某人