Thanks a lot to all for the suggestions. I got diverted to some other job in the middle and could not focus much on this. However, for last two days I am doing some experiments on this.
Following Matt's experience, I thought that it would be safe to go for server side templating. But before that, I thought to give some try to client-side templating and face it first-hand. I used http://blog.markturansky.com/BetterJavascriptTemplates.html. My experience till now is okay with client-side templating, for small portions of the page. To avoid repeating the same code in server-side and client-side templates, I have removed the server side portion and calling the client-side rendering in the "onload" event of the page. Let me see what happens when I render bigger portions. On another note, I discovered http://mjtemplate.org/ which is just like Genshi. Would be interesting to dig further, whenever I will have time. Any comment on this would be helpful. On Sep 22, 5:12 pm, Matt Wilson <[EMAIL PROTECTED]> wrote: > On Sep 16, 7:27 am,Sanjay<[EMAIL PROTECTED]> wrote: > > > Hi, > > > I am a novice in AJAX, pondering on the best way render complex HTML > > from JSON data returned by AJAX calls. > > Are you absolutely certain you need to do the rendering client-side? > I've found it much easier to render complex HTML server-side, and then > usejavascriptto load that block of HTML. > > When I tried to pull down json, and then render json into html, I > found myself recreating kid templates withjavascript(yuck) or > learning some otherjavascripttemplatingsystem. > > I use jQuery forjavascript, and that library has this trick: (I > suspect everyjavascriptlibrary has a similar technique) > > $("div#someID").load("http://example.com/html_fragment", {'a':1, 'b': > 2}) > > That will replace the contents of a div with id "someID" with the > results of the ajax call to the URLhttp://example.com/html_fragment. > That last dictionary/object stuff will get passed along with the HTTP > request. So I can use those parameters to do > > Just my two cents. I found it very difficult to render JSON into > html. A goodtemplatingsystem is not trivial! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

