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);
}
精彩评论