如何检索Google apps帐户用户';使用jqueryajax的个人资料?

如何检索Google apps帐户用户';使用jqueryajax的个人资料?,ajax,gdata,Ajax,Gdata,您可以参考此协议:尝试以下方法: function Retrivecontact() { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); $.ajax({ type: 'GET', url: 'https://www.google.com/m8/feeds/contacts/'+domain+'/full?alt=json', // Url

您可以参考此协议:

尝试以下方法:

function Retrivecontact() {  
   netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");  

   $.ajax({  
     type: 'GET',  
     url: 'https://www.google.com/m8/feeds/contacts/'+domain+'/full?alt=json',  // Url used to get full shared contacts in json form
     //~ url: 'https://www.google.com/m8/feeds/profiles/domain/'+domain+'/full/dhaval.khandhedia?alt=json',  
     //~ url: 'https://www.google.com/m8/feeds/profiles/domain/'+domain+'/full?alt=json',  
     //~ url: 'https://www.google.com/m8/feeds/profiles/domain/'+domain+'/full/dhaval.khandhedia',  
     //~ url: 'https://www.google.com/m8/feeds/profiles/domain/searcelabs.com/full/dhaval.khandhedia',  
     //~ url: 'https://www.google.com/m8/feeds/profiles/domain/searcelabs.com/full',  
     //~ url: 'https://www.google.com/m8/feeds/contacts/'+domain+'/full/378c2a728e358d2b',  
     //~ url: 'https://www.google.com/m8/feeds/contacts/'+domain+'/full?start-index=1',     // Url used to get full contacts in XML
     //~ url: 'https://www.google.com/m8/feeds/contacts/kapil.kaisare@searceapps.com/full?max-results=200&start-index=1',     // Url used to get full CONTACTS in XML of a user

     beforeSend: function(xhr) {  
       $('#data').html('Getting...');  
       xhr.setRequestHeader('GData-Version', '3.0');
       xhr.setRequestHeader('Authorization', 'GoogleLogin auth=' + token);  
     },  
     success: function(resp) {  
     alert($.toJSON(resp));
       //~ var names = $(resp).find('entry>title').text(); /// when XML
            //~ alert(names)
            //~ $('#data').html(names);  
            printjsoncontact(resp);
     },
     error: function(){
    $('#data').html("Error in Request");
     }
   });  
 }  

function printjsoncontact (json)
{
$('#data').html("");
    var length =  json.feed.entry.length;
    for (var i=0; i<length; i++)
    {
        var title = json.feed.entry[i].title.$t;
        etag = json.feed.entry[0].gd$etag
        alert(etag);
        var updated =  json.feed.entry[i].updated.$t;
        var temp = "Title: "+title+", Updated On: "+updated+" </br>";
        $('#data').append(temp);

    }
函数retrieveContact(){
netscape.security.privilegmanager.enablePrivilege(“UniversalBrowserRead”);
$.ajax({
键入:“GET”,
网址:'https://www.google.com/m8/feeds/contacts/“+domain+”/full?alt=json',//用于获取json格式的完整共享联系人的Url
//~url:'https://www.google.com/m8/feeds/profiles/domain/“+domain+”/full/dhaval.khandhedia?alt=json”,
//~url:'https://www.google.com/m8/feeds/profiles/domain/“+domain+”/full?alt=json”,
//~url:'https://www.google.com/m8/feeds/profiles/domain/“+domain+”/full/dhaval.khandhedia”,
//~url:'https://www.google.com/m8/feeds/profiles/domain/searcelabs.com/full/dhaval.khandhedia',  
//~url:'https://www.google.com/m8/feeds/profiles/domain/searcelabs.com/full',  
//~url:'https://www.google.com/m8/feeds/contacts/“+domain+”/full/378c2a728e358d2b”,
//~url:'https://www.google.com/m8/feeds/contacts/“+domain+”/full?start index=1',//用于获取XML格式的完整联系人的Url
//~url:'https://www.google.com/m8/feeds/contacts/kapil.kaisare@searceapps.com/full?max results=200&start index=1',//用于获取用户XML格式的完整联系人的Url
beforeSend:function(xhr){
$('#data').html('get…');
setRequestHeader('GData-Version','3.0');
setRequestHeader('Authorization','GoogleLogin auth='+令牌);
},  
成功:功能(resp){
警报($.toJSON(resp));
//~var names=$(resp.find('entry>title').text();///当使用XML时
//~alert(姓名)
//~$('#data').html(名称);
printjsoncontact(resp);
},
错误:函数(){
$('#data').html(“请求中的错误”);
}
});  
}  
函数printjsoncontact(json)
{
$(“#数据”).html(“”);
var length=json.feed.entry.length;

对于(var i=0;建议的代码结果为:
405(不允许使用方法)

XMLHttpRequest无法加载。访问控制允许源代码不允许使用源代码。我根据其他人的建议回答不同:[here][1][1]: