[Catalyst] AJAX best practices, maximum availability

Bill Moseley moseley at hank.org
Tue Nov 21 05:34:02 GMT 2006


On Tue, Nov 21, 2006 at 01:35:03AM +0000, Ash Berlin wrote:
> The other option for AJAX would be to do something with accept-headers, 
> so make the ajax request request a different content type (I forget the 
> exact terms) and when not using ajax you process the wrapper/surrounding 
> template (i.e. the rest of the page) and then insert the output of what 
> would be the ajax command in the correct place.

That's kind of what I do in many cases.  I write the feature so it
will still work without javascript (redraw the entire page), but also
have the action and template wrappers detect when the request is an
ajax request and return instead json of the just the data that needs
to be updated.

I use Prototype which sets a X-Requested-With header, IIRC.

-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list