JSON call in jQuery to Get All Badges

5 posts

Flag Post

newbie question:

I used jQuery ajax method to make json call (jsonp)
How can I makes all badges json call works?

url: http://jsfiddle.net/Edditoria/LS8zs/

It’s strange.
User badge list works. You can click “Get User Badges” in the above link for testing.

But kong all badges doesn’t. Code is basically the same. But the below error occurs:
" parsererror : Error: jQuery17209025343011599034_1339162861022 was not called "

Did I miss something?

The app I’m developing is based on Ruby on Rails + jQuery + html5 tech.

Please help/suggest. Thanks!

Flag Post

push. I hope someone and official staff can recommend some tips.
m(_ _)m

more question: Should I use RoR/Php/Python (@ server side) to get json data instead of jquery ajax() (in better practice)?

Flag Post

It’s because

All badges:
doesn NOT support `callback` argument in request

User badges:
does support `callback` argument

JSONP works by executing outside script in JSON) – just compare the links to get the idea.

Simple solution would be to retrieve all badges with some server side solution (for example) PHP which doesn’t have issues with cross-domain XHR requests. Put the script in the same domain as your HTML/JS and do normal AJAX request to your script instead of kongregate.

Flag Post

bugs in my reply :)

  • does NOT
  • JSONP works by executing outside script. It means you need a wrapper function to deal with response which is an Object not a string (JSON).
Flag Post

Thanks for your reply. I wait for quite a long time for an answer.

Sometimes newbie need experience developer to confirm whether it is right or wrong.

Many thanks :)