Error with format=json

Avatar image for dynamic_cast
dynamic_cast

8

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#1  Edited By dynamic_cast

I have a problem when retrieving data with the format set to json. The debug console says I have a syntax error which is located in the response from GiantBomb.

No Caption Provided

Avatar image for chaser324
chaser324

9415

Forum Posts

14945

Wiki Points

0

Followers

Reviews: 1

User Lists: 15

#2  Edited By chaser324  Moderator

What's the full query that you're trying to make?

Avatar image for dynamic_cast
dynamic_cast

8

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@chaser324: http://giantbomb.com/api/search/?api_key=key&query=uncharted&resources=game&format=json

Avatar image for ll_exile_ll
ll_Exile_ll

3385

Forum Posts

25

Wiki Points

0

Followers

Reviews: 0

User Lists: 2

I have a problem when retrieving data with the format set to json. The debug console says I have a syntax error which is located in the response from GiantBomb.

Loading Video...

I'm sorry.

Avatar image for chaser324
chaser324

9415

Forum Posts

14945

Wiki Points

0

Followers

Reviews: 1

User Lists: 15

#5  Edited By chaser324  Moderator

Looking at the other thread you created, it looks like you're trying to do an AJAX call, in which case you need to make sure you specify that you want a result in the JSONP format and that you specify a callback.

Here's an example I just threw together. Just plug in your API key and try it out in your console: https://gist.github.com/Chaser324/15546811139ed13956b0

Take note of the 'json_callback=callback' parameter which references the function 'callback' defined below.

Avatar image for zauzazu
Zauzazu

75

Forum Posts

2

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

Avatar image for dynamic_cast
dynamic_cast

8

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#7  Edited By dynamic_cast

@chaser324: Thanks. It worked. I read that jQuery automatically appends a callback parameter so I was not bothering with it.

Avatar image for chaser324
chaser324

9415

Forum Posts

14945

Wiki Points

0

Followers

Reviews: 1

User Lists: 15

#8  Edited By chaser324  Moderator
Avatar image for dynamic_cast
dynamic_cast

8

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@chaser324: I don't know if "error" is the correct word to use in relation to the first solution you gave because this updated one is no longer working for me. The complete function still executes to log "done" to the console but the callback isn't firing.

Avatar image for ch3burashka
ch3burashka

6086

Forum Posts

100

Wiki Points

0

Followers

Reviews: 0

User Lists: 3

Hey guys, remember that Quantic Dream game with that one kid whose name sounds like that thing he said? Wouldn't that be funny?

Oh wait...

Avatar image for chaser324
chaser324

9415

Forum Posts

14945

Wiki Points

0

Followers

Reviews: 1

User Lists: 15

#12 chaser324  Moderator

@dynamic_cast: The modified version totally works for me, but yeah, the first one isn't necessarily wrong. Use whatever works for you.