开发者

How do you request JSON data from an API on a different domain?

I was trying to retrieve some JSON data from Google's AppEngine, and also a test domain I setup, and I can't figure out how to use jQuery to access this remote data. Works fine on the local server =/

var _this = this;
        $.getJSON(url,input,function(_data,_status){

             _this.data  = _data;   
             _this.status = _status;

             log(_this.data);
                 setTimeout( function(){ $(_this).trigger("postresponse"); } , 300);

         })
        .error(function(e){ 
                log(e);
                log("Request Failed");

        }); 开发者_运维百科

Every time I do this with .get or .getJSON I get a 200 OK Error?? with no data, or if I use .post I get a 405 "Method Not Allowed" Network Error


Ajax does not allow cross-domain activity. It's not enabled in the browser.


I would use: http://code.google.com/p/jquery-jsonp/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜