Search code examples
jqueryajaxgoogle-contacts-api

Google Contacts API can't call max-results with JQuery AJAX


This is my code:

$.ajax({
url: 'https://www.google.com/m8/feeds/contacts/default/full',
dataType: 'jsonp',
data: { access_token: token, max-results: '5000', alt: 'json' },
success:function(data){ /*magic*/ }
});

The issue is that max-results has the "-" character.

How can I work around this and keep the parameter?


Solution

  • Just use a string literal as the name of the property

    $.ajax({
    url: 'https://www.google.com/m8/feeds/contacts/default/full',
    dataType: 'jsonp',
    data: { access_token: token, 'max-results': '5000', alt: 'json' },
    success:function(data){ /*magic*/ }
    });