I use this all the time for intranet development.  It is really useful for client-side 
validation and dynamic page building.  For validation, use the object to post values 
to a page and then wait for the results.  In one application, I use this to validate 
state/country/postal code combinations.  This is great because it doesn't require 
posting the actual data entry form until it is totally validated.

For dynamic page building, I use the object in conjuction with a DHTML tab control 
that I created.  Waiting for the entire page to load with all of the tabs populated 
can take a long time.  I get around this by loading the page with only the first tab 
populated and then the onLoad event of the body tag fires off successive calls to 
XMLHTTP to get the content for the other tabs.  This content is assigned to the 
innerHTML of each tab.

Here is a JS function which wraps the calls.  The paramater sContent contains pair 
values that will be posted to sPage (seperate multiple values with an ampersand).

function postPage( sContent, sPage )
{
        var oHTTP;
        var sRetVal;

        oHTTP = new ActiveXObject('Microsoft.XMLHTTP');
        oHTTP.Open('POST', sPage, false);
        oHTTP.setRequestHeader('Content-type','application/x-www-form-urlencoded');
        oHTTP.Send(sContent);
        sRetVal = oHTTP.responseText;
        oHTTP = '';

        // This will remove all tags from the output, which may be added by
        // application.cfm.
        return sRetVal.replace(/<[^<>]*>/g,'');
}

See this article at M$ for more info:

http://support.microsoft.com/support/kb/articles/Q290/5/91.ASP

Hope this helps.

Craig Howarth


> -----Original Message-----
> From: Robert Everland III [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, May 28, 2001 10:08 PM
> To:   CF-Talk
> Subject:      Using IE5 HTTP com object
> 
> I have looked on cfcomet.com and have not found an answer to this, does
> anyone have any example code for using IE5 http com object. I would like to
> do some things with it.
> 
> 
> Bob Everland
> 
> 
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to