简体   繁体   English

jQuery / ajax:jsonp调用出现问题

[英]JQuery/ajax : Problem with jsonp call

I am trying to make a cross-site request, on a site that needs authentication. 我试图在需要身份验证的站点上提出跨站点请求。 The authentication works with a cookie. 身份验证与cookie一起使用。

For some reason, when I am doing this call : 由于某些原因,当我打电话时:

$.getJSON(url + '?', function(data){
    alert(data);
});

I don't see the Cookie sent in the HTTP headers. 我没有在HTTP标头中看到发送的Cookie While when I just copy paste url in my address bar, the call is successful, and Cookie is set properly... 当我只在地址栏中复制粘贴url时,呼叫成功,并且Cookie设置正确...

I tried to replace the $.getJSON by a $.ajax , and set manually the request headers. 我试图用$.ajax代替$.getJSON ,并手动设置请求标头。 It resulted in the request not even visible in firebug (while I know it has been sent and answered to by using another tool)!!! 这导致请求甚至在萤火虫中都不可见(虽然我知道它已通过使用其他工具发送并得到答复)!

I am using firefox 3.6, jquery 1.4 我正在使用Firefox 3.6,jQuery 1.4

Any idea on what's going on ? 有什么想法吗?

这是同一来源策略的一部分,对其他域的 JSONP请求将不会发送任何cookie。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM