开发者

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

开发者 https://www.devze.com 2023-04-04 18:02 出处:网络
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 =

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

精彩评论

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