This might be of interest to you, too:
http://code.google.com/p/trimpath/wiki/JavaScriptTemplates
It will get you around having to do stuff like:
$.each(entry['model'], function(modIndex, mod){
result += '<li>'+ mod + '<\/li>';
});
I use it all the time for merging json data into "jst" templates (jst's
are just plain text/html files with template stuff in them). Works
great, is quite fast, too. I've used it for a large reporting project,
with giant tables of data: rather than generating a bunch of html on the
server and passing it to the client, I just pass json back and use
trimpath and a jst to do the merge and a simple
$('#myDiv').html(mergeResults); to dump the results to screen. More fun,
IMO, than the various DOM-node building plugins, too.
FYI, I usually use jquery $.get() to fetch the jst file from the server,
rather than use textareas and such (which is what the simple demo's
there show).
- Jack
GianCarlo Mingati wrote:
Hi all.
http://www.gcmingati.net/wordpress/wp-content/uploads/jsonhelicopters.html
Here's what i learned form the book, chapter 6 (Ajax techniques).
I went faster than i expected. The book explains clearly and easily
how to dinamically insert content into a page... wow this is hooking
me as much as my r/c helicopters do.
Now i know i can use xml, json, plain html or even javascript files as
external 'data'. Personally the json methos seems the easier.
In the example my first page EVER with data from a separate json file.
Ciao!
I'm happy, i'm getting into this "web2.0" stuff with fun.
GC