2012-04-01 39 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"更換方法。

相關問題