开发者

How do i retrieve Google apps account user's profile using jquery Ajax?

开发者 https://www.devze.com 2023-03-31 18:05 出处:网络
you can refer this protocol: http://code.google.com/apis/apps/profiles开发者_如何学编程/developers_guide_protocol.htmltry this thing:

you can refer this protocol: http://code.google.com/apis/apps/profiles开发者_如何学编程/developers_guide_protocol.html


try this thing:

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);

    }
0

精彩评论

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

关注公众号