开发者

problem calling wikirandom api using jquery

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜