Fog Creek Software
Discussion Board




Dynamic Content

How to submit data to a server-side script and then display the output within a webpage without submitting the entire webpage?

In other words, how to mimic the gmail behavior? It adds content dynamically to a webpage without (most of the times) actually submitting the entire webpage.

anonFanon
Thursday, August 05, 2004

You could use something like an IFrame, which you can submit separately to the rest of the page. You would probably have to write some javascript/dhtml to make it work the way you want it. I've got no idea how gmail does it but this sounds like a plausible way of doing it.

James U-S
Thursday, August 05, 2004

Why not just look at how Gmail does it ?

Nemesis
Thursday, August 05, 2004

You can get Javascript to fetch data from your server using XmlHttpRequest: http://developer.apple.com/internet/webcontent/xmlhttpreq.html
I think that's how Gmail does it.

Matthew Lock
Thursday, August 05, 2004

Nice example here too of a web page requesting more content after it has loaded: http://developer.apple.com/internet/webcontent/XMLHttpRequestExample/example.html

Matthew Lock
Thursday, August 05, 2004

I wrote something about this in my "html carol" post.  Yes you can use a hidden iframe/object as your RPC bridge.  The response can contain script to modify elements of your web page's interface and so on.

However, I think that the best way to do this kind of thing is with a simplifying language (whose implementor can worry about the fiddly details of iframes and page state).

Kalani
Thursday, August 05, 2004

Here is another good explanation/tutorial about using IFrames. By the way, if you're wanting to Google about this stuff, I believe the concept is called "Remote Scripting".
http://developer.apple.com/internet/webcontent/iframe.html

Jordan Lev
Thursday, August 05, 2004

Trouble with iframes is that annoying click that IE makes when it reloads.

Matthew Lock
Thursday, August 05, 2004

That's why gmail uses javascript to dynamically populate divs, which is very easy to do.  Problem is, Opera has no way to use javascript to make an http request, so you're stuck with mozilla/ie.

saberworks
Thursday, August 05, 2004

Netflix does this with the star rating system (click 3 stars and poof, you've rated the movie - no page refresh). Amazon does this now.

I think this is netflix's code for it:

http://www.netflix.com/layout/jscript/starbar_v2.js

www.MarkTAW.com
Thursday, August 05, 2004

*  Recent Topics

*  Fog Creek Home