API request with JSONP "Uncaught SyntaxError"

Avatar image for diaz_lueantz
diaz_lueantz

6

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

Hi guy,

I am just recently join Giant Bomb and trying to requests some data but unexpected there is some error encounter "Uncaught SyntaxError: Unexpected token", there is url below:

var api = "http://www.giantbomb.com/api/reviews/?api_key=[TokenKey]&format=json&limit=3&sort=publish_date:desc";

function Myfunction () {

$.ajax({

url: api,

type: "GET",

dataType: "jsonp",

crossDomain:true,

jsonp:"false",

jsonpCallback: "callback",

success: function(result){

<!--Some code after success-->

},

error: function(result){

console.log("Error");

},

});

Pleaseee help ~~~~~~

Avatar image for chaser324
chaser324

9415

Forum Posts

14945

Wiki Points

0

Followers

Reviews: 1

User Lists: 15

#2  Edited By chaser324  Moderator

A few things:

  • In the URL, it should say format=jsonp
  • Get rid of the jsonpCallback parameter and set jsonp equal to "json_callback" - if you really want to override the default callback value, set jsonp to false not "false".
Avatar image for diaz_lueantz
diaz_lueantz

6

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0