开发者

JQuery call to oodle API returns nothing?

My question is specific to oodle API.

I am trying to call oodle API to get the JSON result like this:

$.getJSON("http://api.oodle.com/api/v2/listings?key=TEST&region=sf&category=sale&format=json&mappable=address&jsoncallback=none", function (data) {
    alert(data);
}开发者_运维百科


You cannot make cross domain request (XSS). You will need to use JSONP by changing the jsoncallback parameter from your request to jsoncallback=? instead of none. The latest version of jquery will then handle JSONP correctly.

The Oodle API specs mentions jsoncallback: http://developer.oodle.com/listings


$.getJSON("http://api.oodle.com/api/v2/listings?key=TEST&region=sf&category=sale&format=json&mappable=address&jsoncallback=?", function (data) {
    alert(data);
});

This uses JSONP. The ? tells jQuery where to insert the name of the callback. You had none, which is incorrect. Also, you were missing a right paren.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜