Hijacking Requests with Ajax

Published in Programming and Scripts on Monday, January 2nd, 2006

A nice little write-up about how to use Ajax and degrade gracefully from Jeremy Keith over at DOMscripting.

Posting in the weblog over at DOMscripting, Jeremy states ...you should just be building old-fashioned page by page submissions before hijacking them with Ajax, and then goes on to add Plan for Ajax from the start. Implement Ajax at the end.

Planning

In my experience with AJAX to date this method has worked well for me. By planning things out properly, I tend to handle the guts of the request being made - that is, the data manipulating or just plain main point of the action - with one controller while another controller takes the results of that request and assembles a webpage to send to the browser.

Page level or action level

Stated another way, there is a page level controller and another action level controller. When using the application without Javascript, the request is passed to the page level controller which carries out the interaction and passes back a webpage to the browser. With Javascript, the request is passed straight to the action level controller, which returns data for the specific action being carried out.

So far this has worked out well...

Comments and Feedback

cms_loopIntoHTML: $data must be an array

Check out the blog categories for older content