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.


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

Home » Blog » Web Development » Programming and Scripts

Check out the blog categories for older content

The latest from my personal website,
Mike Papageorge.com

SiteUptime Web Site Monitoring Service

Sitepoint's web devlopment books have helped me out on many occasions both for finding a quick solution to a problem but also to level out my knowlegde in weaker areas (JavaScript, I'm looking at you!). I am recommending the following titles from my bookshelf:

The Principles Of Successful Freelancing

I started freelancing by diving in head first and getting on with it. Many years and a lot of experience later I was still able to take away some gems from this book, and there are plenty I wish I had thought of beforehand. If you are new to freelancing and have a lot of questions (or maybe don't know what questions to ask!) do yourself a favor and at least check out the sample chapters.

The Art & Science Of JavaScript

The author line-up for this book says it all. 7 excellent developers show you how to get your JavaScript coding up to speed with 7 chapters of great theory, code and examples. Metaprogramming with JavaScript (chapter 5 from Dan Webb) really helped me iron out some things I was missing about JavaScript. That said each chapter really helped me to develop my JavaScript skills beyond simple Ajax calls and html insertion with libs like JQuery.

The PHP Anthology: 101 Essential Tips, Tricks & Hacks

Like the other books listed here, this provides a great reference for the PHP developer looking to have the right answers from the right people at their fingertips. I tend to pull this off the shelf when I need to delve into new territory and usually find a workable solution to keep development moving. This only needs to happen once and you recoup the price of the book in time saved from having to develop the solution or find the right pattern for getting the job done..