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.
精彩评论