最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - How to request different domain with Ajax in jQuery - Stack Overflow

matteradmin8PV0评论

I need to make a request to a different domain with Ajax in jQuery!

Should I use iframe?

Edited:

On facebook working chat, with few different domain name?

GET http:// www.facebook/ajax/presence/reconnect.php?__a=1&reason=6&iframe_loaded=false&post_form_id=23be2df75b74a0bcb61358814c56ba4f 200 OK

GET 200 OK

I want something like...

I need to make a request to a different domain with Ajax in jQuery!

Should I use iframe?

Edited:

On facebook. working chat, with few different domain name?

GET http:// www.facebook./ajax/presence/reconnect.php?__a=1&reason=6&iframe_loaded=false&post_form_id=23be2df75b74a0bcb61358814c56ba4f 200 OK

GET http://0.50.channel.facebook./x/2562941315/4271808869/true/p_1529934952=2 200 OK

I want something like...

Share Improve this question edited Oct 25, 2010 at 9:03 Sculea Vasile asked Oct 25, 2010 at 0:22 Sculea VasileSculea Vasile 313 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 6

You can not because of same origin policy.

You have a few options.

JSONP

You make a request with a script element, and pass it a callback to one of your functions to handle the data.

Server side proxy

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.

You can't. Consider using JSONP instead, which uses <script> tags to retrieve data.

Take a look at http://api.jquery./jQuery.getJSON/ and JSONP

Post a comment

comment list (0)

  1. No comments so far