为什么 IE 中的 jQuery Ajax 请求返回 null?
这就是我的请求现在的样子。如果我直接访问服务器网址,它就可以工作。它正在返回所需的数据。在 Chrome 和 Firefox 中工作完美。在 IE 中则不然。请求成功但返回的json为null。它在 Firefox 3.0 中的作用与 IE 中的作用相同。
$.ajax({
type: "POST",
url: "http://www.tpltm.ro/dbm/index.php?r=routes/get&type=4e60922f2eb58",
cache: false,
contentType: "application/json; charset=utf-8",
dataType : "json",
success: function(msg) {
console.log(msg);
createMenu(msg);
},
error: function() {
console.log("Error: ajaxRequest");
}
});
This is how my request is looking right now. If i acces directly the server url it works. It's returning the needed data. In Chrome and Firefox works flawless. In IE it doesn't. The request is successful but the returned json is null. It does the same thing in Firefox 3.0 as in IE.
$.ajax({
type: "POST",
url: "http://www.tpltm.ro/dbm/index.php?r=routes/get&type=4e60922f2eb58",
cache: false,
contentType: "application/json; charset=utf-8",
dataType : "json",
success: function(msg) {
console.log(msg);
createMenu(msg);
},
error: function() {
console.log("Error: ajaxRequest");
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确定问题不仅仅是“console.log(msg);”吗这会导致 IE 在执行“createMenu”函数之前无提示地失败?
Are you sure the problem isn't simply the 'console.log(msg);' which would cause IE to silently fails before executing the 'createMenu' function ?