Hi Samuel,

Why "one page applications for example, transforming the JSON client side is
a must"?

For one-page-application, it is still feasible to have XHR response as HTML
partials.

Thanks,
-Morgan




On Sat, Sep 10, 2011 at 9:54 PM, Samuel Richardson <s...@richardson.co.nz>wrote:

> There's a lot of factors to take into account, but if you have control over
> the entire environment then I find working with JSON
> that's transformed using JST templates to be the most flexible way of doing
> things.
>
> That being said, there are cases for the server rendering HTML and the XHR
> request inserting it into the page (also, jQuery's live binding can be very
> helpful in this situation). The server might be configured already for
> rendering HTML server side, it might be pulling content from existing
> templates in other areas or in some cases, the backend team might just not
> be very good or unable to handle JSON for whatever reason.
>
> For applications that are very programmatic, one page applications for
> example, transforming the JSON client side is a must. For more static
> applications, you can use the HTML bound with live events instead.
>
> Samuel Richardson
> www.richardson.co.nz | 0405 472 748
>
>
>
> On Sat, Sep 10, 2011 at 10:50 PM, Martin <goo...@martindoyle.com> wrote:
>
>> From a separation and maintenance point of view (I'll leave others to
>> discuss performance), having a server generate HTML is definitely a bad
>> thing. I'm working on a several-year-old website at work which has elements
>> of modern Dojo-based JSON REST services but also older XSLT-generated
>> server-side HTML generation that's then replaced client-side, and I can
>> assure you that fixing bugs or altering the code in the old server-generated
>> HTML "bit" is much, much harder work.
>>
>>
>> On Sat, Sep 10, 2011 at 11:44, Mo Cheng <morgan.chen...@gmail.com> wrote:
>>
>>> Hi All,
>>>
>>> In highly AJAX-ified web site, XHR is used to update part of page, which
>>> basically update partial HTML tags. Then we need to make a decision:
>>> Should server render the HTML and sent in XHR response? or Should server
>>> just return JSON data and have browser JavaScript render HTML according to
>>> JSON data?
>>>
>>> Anybody has experience in both approaches? Which is more performant?
>>>
>>>
>>> Thanks,
>>> -Morgan
>>>
>>> --
>>> To view archived discussions from the original JSMentors Mailman list:
>>> http://www.mail-archive.com/jsmentors@jsmentors.com/
>>>
>>> To search via a non-Google archive, visit here:
>>> http://www.mail-archive.com/jsmentors@googlegroups.com/
>>>
>>> To unsubscribe from this group, send email to
>>> jsmentors+unsubscr...@googlegroups.com
>>>
>>
>>  --
>> To view archived discussions from the original JSMentors Mailman list:
>> http://www.mail-archive.com/jsmentors@jsmentors.com/
>>
>> To search via a non-Google archive, visit here:
>> http://www.mail-archive.com/jsmentors@googlegroups.com/
>>
>> To unsubscribe from this group, send email to
>> jsmentors+unsubscr...@googlegroups.com
>>
>
>  --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/jsmentors@jsmentors.com/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/jsmentors@googlegroups.com/
>
> To unsubscribe from this group, send email to
> jsmentors+unsubscr...@googlegroups.com
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to