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
use javascript to load that block of HTML.
When I tried to pull down json, and then render json into html, I
found myself recreating kid templates with javascript (yuck) or
learning some other javascript templating system.
I use jQuery for javascript, and that library has this trick: (I
suspect every javascript library 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 URL http://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 good templating system 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
-~----------~----~----~----~------~----~------~--~---