开发者

problem calling wikirandom api using jquery

开发者 https://www.devze.com 2023-04-02 12:42 出处:网络
I\'m trying to call this api http://www.wikirandom.org/json Using this code - $.getJSON(\'http://www.wikirandom.org/json\', function(data) {

I'm trying to call this api http://www.wikirandom.org/json

Using this code -

    $.getJSON('http://www.wikirandom.org/json', function(data) {
  //do somthing
   });

I'm not getting a response. if I go to the url directly it works fine.

if I use the following in the head of my doc it calls no problem. -

 <script src="http://www.wikirandom.org/json?&callback开发者_运维技巧=functionThatalertsdata&pages=1&languages=en" type="text/javascript"></script>

Any ideas?


This is due to the same origin policy in Javascript.

0

精彩评论

暂无评论...
验证码 换一张
取 消