2012-04-01 66 views
1

我尝试从用户获取用户图像配置文件。我创建一个使用jQuery这样的AJAX请求:Google用户内容Javascript api

$.ajax({ 
    type: "get", 
    url: "https://www-opensocial.googleusercontent.com/api/people/myusername/@self", 
    contentType: "application/json; charset=utf-8", 
    data: {}, 
    success: function (result) { 
    image = result.entry.thumbnailUrl; 
    name = result.entry.displayName; 
    }, 
    error: function() { 
    } 
}); 

但我得到405错误消息。 当我从浏览器请求URL时,我正确地获取了json对象。

用c#.Net解决方案也不错。 谢谢。

+0

如果你想'GET' JSON数据,你也可以使用'$ .getJSON'。另外,你有什么样的参考你想要检索? – m90 2012-04-01 08:23:51

回答

0

HTTP错误405说不准和您在Ajax请求写道type: "get",在你的代码type: "GET"更换方法。

相关问题