I’m new to JSON & am having a hard time trying to get my head around it. I found a cool library called Tempo ( https://github.com/twigkit/tempo/ , http://twigkit.github.com/tempo/ ) that seems to make working with JSON much easier but I still cannot get it to work on my simple example using Dribbble’s API. Can anyone point me in the right direction?
I have created a fiddle at: http://jsfiddle.net/mrmartineau/2uDZK/ which can also be viewed more easily here: http://fiddle.jshell.net/mrmartineau/2uDZK/show/ . You will see that I have tried a number of different things, none of which work… Also, I would like to know how I control how many results are displayed on the page if my example were to work – Dribbble has documentation here: http://dribbble.com/api (I am using the get_shots_list example btw: http://dribbble.com/api#get_shots_list)
I think I have an inherent misunderstanding of how to handle a JSON feed (if that’s what you call it) so I would appreciate someone setting me straight.
Many thanks in advance
Just a couple of minor things. This is how you would invoke Tempo with JavaScript (including adding a ‘loading’ icon’.
And here’s a template showing dribbbles and player information. Notice that we render the entire JSON response (
data), and use a nested template (data-template="shots") to render each shot. This allows you access things like the{{found}}variable.You can see this (styled) in action here: http://twigkit.github.com/tempo/examples/dribbble
Good luck!
Stefan