这是链接: https://codepen.io/devanshchawla/pen/XgdrvE?editors=1111
var API="https://en.wikipedia.org/w/api.php?action=query&format=json&prop=info&generator=search&gsrsearch=Albert&callback=?";
$(document).ready(function(){
$.getJSON(API,function(json){
console.log(json);
});
});
输出结果为:
Object{
batchcomplete: "";
continue: Object{
continue: "gsroffset||",
gsroffset: 10
},
query: Object{
pages: Object{}
}
}
当我将URL复制并粘贴到浏览器中时,我得到了预期的输出。