gpt4 book ai didi

jQuery $.getJSON 不在 IE 中发送请求(适用于 FF 和 Chrome)

转载 作者:行者123 更新时间:2023-12-01 03:21:01 27 4
gpt4 key购买 nike

我处于 IE9 的 Debug模式。我在第一行(如下)放置了一个断点,然后它就命中了。但是,我在回调中第一行的断点从未被命中。

查看网络选项卡后,我没有看到对该 URL 的请求(设置为“http://localhost/PopNote/”)。

$.getJSON(
URL + "messages/getUnreadMessages.json?" + Math.random(), // add random to prevent IE cache
{
productKey : this.productKey,
listIds : this.listIds,
personEmail : this.personEmail
},
function(data) {
if(data.messages.length == 0) return;

为什么请求没有被发送(并且仅在 IE 中)?

谢谢!

最佳答案

神圣的鳄梨酱!这是一些错误!这是我修复它的方法:

  1. jQuery.support.cors = true; 添加到我的脚本的开头
  2. 在我的 $.ajax 选项中添加了 crossDomain: truedataType: 'jsonp'
  3. 将我的 JSON 代码转换为 JSONP 格式,例如:

    $_GET['回调'] 。 '('.json_encode($data).');'

还有瞧!这是我今天调试过的最难的错误。

关于jQuery $.getJSON 不在 IE 中发送请求(适用于 FF 和 Chrome),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9946608/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com