[thelist] GET requests and sent content

Courtenay court3nay at gmail.com
Mon Oct 11 22:57:28 CDT 2004


I do a similar thing on one of my sites but due to my lack of  XMLHTTP
knowledge, I use a few kludges.  The sites contain a lot of data that
the user can edit, more than 20 (long) fields in a form, and sometimes
up to 80.  Unfortunately necessary, but they only tend to change one
or two fields (status updates and the like)

- The form contains many fields (like a grid).  I check if
defaultValue == value, and remove any nodes which haven't been
changed.  This usually cuts a 20 field page down to one or two.
- Then I create an IFrame, append it to the DOM tree, submit the form
to that.  The resulting page, which is extremely lightweight, calls a
function in the opener (main) document, to notify of success or
failure, by passing variables or objects.  Netflix kinda does this
with their star ranking system.
- This function clears the form off the page and reveals (or creates)
a new DIV on the page along the lines of 'thankyou, form submitted'.
with the result that there is minimal data transferrance.

Without javascript, or older javascript, or non-DOM, the whole thing
degrades gracefully, the form gets submitted  (to a different
handler), and the user sees pretty much the same thing, except, it
takes a (bit) longer and there is a flurry of data going back and
forth, and the inevitable page reload.  This way the whole thing works
even in your grandpa's browser, and as the javascript is in an
external file, can be cached and only needs to load once for the site.
 Score!

The idea for the IFrame came from an excellent Apple developer article

http://developer.apple.com/internet/webcontent/iframe.html

Does anyone have a link to doing the same thing with XMLHTTP?  I know
nothing about it (time to check that O'Reilly safari subscription?) 
Or if you have any better ideas ;)




On Mon, 11 Oct 2004 18:08:41 -0700, Mark Groen <markgroen at gmail.com> wrote:
> > Paul Bennett wrote:
> >
> > > I have been told
> > > by the very knowledgable lead developer that normal form get and post
> > > requests also send back the entire html of the page they are on and
> > > hence they use JS to minimize the size of the sent data.
> > >
> > > This to me seems ludicrous.
> 
> I think Hassan is right on this one and you misinterpeted the
> conversation. As you say, this developer is considered very
> knowledgable, and it's learned fairly early in basic html classes that
> forms send a set of data to the server. Don't think he meant the
> entire file gets sent back to the server, but rather the response to
> the client from the data sent in the "other/unwanted" method, was to
> serve another page with the new data, rather than just replacing what
> was needed.
> 
> Hassan: "Using, say, XMLHTTP to retrieve a small XML dataset clearly uses less
> bandwidth, since the page markup itself isn't discarded and replaced."
> 
> cheers,
> 
>        Mark
> 
> 
> --
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>


More information about the thelist mailing list