Rick Hurst Web Developer in Bristol, UK


own brand AJAX

There seems to be a lot of hype about AJAX at the moment, even an AJAX summit recently.

I have been using a similar (but cruder) technique for loading in content to a page without a page reload for a few years using iframes, javascript and the Document Object Model. oh… don’t think i’m claiming I invented it by the way, but I did work out a way of doing it in isolation without seeing any examples. For me it was just for a problem I needed to solve for a content management system where I had a large form and wanted to load in content from a database without having to save the form first.

Below is an example – I have simplified what I did to make it look as simple as it really is. There is a “hidden” iframe (i.e. 0 height and width) into which you load an ordinary HTML page (or script) which as a few lines of javascript that copy the contents of a specified div in the hidden page to a specified div on the calling page. I have created an empty div below to load the content into.

if you are reading this on the website rather than via an RSS aggregator give it a go:-

load external content into empty div below

(empty div)

UPDATE: since I migrated this blog to wordpress, this example no longer works as the iframe is stripped out – I will set up a static page to demonstrate this when I get a sec