Tuesday, October 2nd, 2007p>Last week, we posted a tutorial by Brian Reindel which showed how to parse XML with jQuery. The feedback was pretty good but many readers felt that JSON is the data packet format of choice and an XML-focused tutorial wasn’t their cup of tea. Brian promised a follow-up tutorial focusing on JSON and he has delivered.
Getting JSON using jQuery is extremely straightforward. Just like $.ajax(), there is a $.getJSON() method, with a call to a file, and a function to pass the data through for parsing. The common $.each() method in jQuery can be used to traverse the â€œnodesâ€ (keys) that you indicate. You could just as easily use your own for loop.
As usual, Brian includes plenty of code examples to further reinforce his techniques and provides a source code download for you to review.
You can catch both tutorials here:
Posted by Rey Bango at 8:59 am