Cross Domain Ajax Request with JQuery/PHP

前端 未结 6 581
南笙
南笙 2020-11-30 13:28

Help, if you can-

The situation:

http://foobar.com includes a remotely hosted javacript file (http://boobar.com/stuff.js).

The goal is to just get an

6条回答
  •  佛祖请我去吃肉
    2020-11-30 13:51

    You can get data from another server asynchronously using script tags and json:

    
    

    You can use this to dynamically load a remote javascript (by created a new script element and setting the src attribute, then loading into the DOM), which could set a variable. However, you need to really trust the remote site, because the JS will be evaluated without any precondition.

提交回复
热议问题