如何申请不同的域使用Ajax jQuery中 [英] How to request different domain with Ajax in jQuery
问题描述
我需要一个请求到不同的域与阿贾克斯jQuery的!
I need to make a request to a different domain with Ajax in jQuery!
我应该使用 IFRAME
?
编辑:
在facebook.com正在聊天,有几个不同的域名?
On facebook.com working chat, with few different domain name?
GET HTTP:// www.facebook.com/ajax/$p$psence/reconnect.php?__a=1&reason=6&iframe_loaded=false&post_form_id=23be2df75b74a0bcb61358814c56ba4f 200 OK
GET http:// www.facebook.com/ajax/presence/reconnect.php?__a=1&reason=6&iframe_loaded=false&post_form_id=23be2df75b74a0bcb61358814c56ba4f 200 OK
GET http://0.50.channel.facebook.com / X /4271808869分之2562941315/真/ p_1529934952 = 2 200 OK
GET http://0.50.channel.facebook.com/x/2562941315/4271808869/true/p_1529934952=2 200 OK
我想是这样...
推荐答案
您不能因为同源策略。
您有几个选项。
您做出了剧本
元素的请求,并把它传递一个回调到您的函数来处理数据之一。
You make a request with a script
element, and pass it a callback to one of your functions to handle the data.
基本上,你创建在服务器端的包装。您可以使用卷曲或同等学历。请求中的数据与您的服务器,然后从同一个域下为它服务。
Basically, you create a wrapper on the server side. You can use cURL or equivalent. Request the data with your server and then serve it from under the same domain.
这篇关于如何申请不同的域使用Ajax jQuery中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!