开发者

GData API and cross-domain ajax calls

I want to get xml data from google server using it's API. so, i can't make any changes to response. So, How do I make this call that work for me开发者_高级运维:

 $.ajax({  
     type: 'POST',  
     url: 'https://www.google.com/accounts/ClientLogin',  
     contentType: 'application/x-www-form-urlencoded',  
     data: { accountType : "HOSTED", Email : ""+Adminemail+"", Passwd : ""+adminpass+"", service : "cp"}, // cp for contact service..
    success: function (response) {
alert(response); });

I want make some GET, PUT, DELETE call as well so, I don't want to use any function like $.getJSON();I want to make it possible through $.ajax() only.


I think only way to do this is use of server side scripting language.


Most browsers won't allow cross site scripting. (An ajax call that is not in your own domain).

So if you want to call such an url (https://www.google.com/accounts/ClientLogin), do it server side.


Cross domain posting is blocked by the browser. You could write your own browser. Since this is probably not an option, you could post to your own server and from there post to the other server. I think you can post data to another server using cUrl if you're using PHP.

There's a nice example here.


The third party must provide a jsonp api.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜