Data loading question
September 13, 2004 1:51 AM   Subscribe

JavaScript (probably)...

Is there a reliable, cross-browser, way of loading dynamic (server side) data into a page without a reload (using a client side script)? I'm trying to imitate the action of a pop-up (supplying context-sensitive information), but in div without having to use new windows or iframes or anything.

I've found a couple of proprietary xml methods, but nothing I can rely on.
posted by monkey closet to Computers & Internet (6 answers total)
Best answer: XMLHttpRequest and innerHTML
posted by yerfatma at 4:02 AM on September 13, 2004

Remote scripting with an iFrame will catch more browsers than XMLHttpRequest, (if you don't mind a "reload" happening in a hidden iframe).
posted by alan at 4:38 AM on September 13, 2004

It's worth noting, though, that support for XMLHttpRequest is rapidly growing in browsers, because of its use in Gmail.
posted by reklaw at 4:42 AM on September 13, 2004

The method I've used is similar to the iFrame idea, but uses a regular frame, hidden by setting the frameset to 100%, *. Load data into the hidden frame, then onLoad have it shuttle its data to your page via the DOM.

It's both reliable and cross-platform (back to NS4) since it doesn't rely on iFrames.
posted by Jeff Howard at 10:32 AM on September 13, 2004

Yeah, but then you have a *shudder* regular frame. :)
posted by alan at 11:29 AM on September 13, 2004

Awesome, yerfatma. I've been recently looking at doing some advanced XML work and had given up on IE since all the scripts I'd found triggered security warnings (unacceptable), but the one you linked to doesn't. Yay hooray!

You just saved me from writing my own XPath and XML Schema parsers... although I'm kind of sad, too, since I've already written a large chunk of both, and now the effort's likely wasted.
posted by Khalad at 2:53 PM on September 13, 2004

« Older Vinyl Lining of Sandals + Sweat = Awful, Awful...   |   How does skywriting work? Newer »
This thread is closed to new comments.