0

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?

Kara
  • 6,115
  • 16
  • 50
  • 57
David Shaw
  • 105
  • 9

2 Answers2

1

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*/ }
});
Musa
  • 96,336
  • 17
  • 118
  • 137
  • Thanks a lot! I also just made the whole request into one giant string and called it from data without an array... e.g. var dataElem = 'access_token='+token+'&max-result=5000&alt=json'; ... data: dataElem – David Shaw Dec 19 '12 at 16:34
0

try this, it works for me

$.ajax({ url: 'https://www.google.com/m8/feeds/contacts/default/full?max-results=1000',
                          dataType: 'jsonp',
                          data: authParams,
                          success: function(data) {
                              console.log(data);}})
ALEX ORTIZ
  • 179
  • 1
  • 7