Error processing SSI file
Error processing SSI file

Home » Development Area » DigiGuide Listings Grabber » API Index » Class: XMLHttpRequest

Class: XMLHttpRequest


Summary

Our implementation of XMLHttpRequest. This is not related to, nor does it necessarily share features or limitations with, web browser versions.


Remarks

Our implementation of XMLHttpRequest does not currently support asynchronously downloading files.


Methods

MethodDescription
 abort Abort the current download
 getAllResponseHeaders Get all of the HTTP response headers sent from the server
 getResponseHeader Get a specific HTTP response header value
 open Open a connection to use to make our requests.
 send Start the request
 setRequestHeader Set a request header to send to the server.


Events

EventDescription
 onreadystatechange Override this to be notified when the state of the request changes.

Because we don't yet support async this is not needed.


Properties

PropertyDescription
 readyState The state of the request.

Value Action
0 uninitialized
1open
2sent
3receiving
4loaded

 responseBody A string containing the response from the request. This might be binary data.
 responseText String containing the response from the server. This is the plain text version.
 responseXML String containing the response from the server. This is the XML version. Note that this returns the exact same content as responseText as we don't support XML directly.
 status HTTP return status of the request.
 statusText Text description of the status.


Examples

The example below gets the DG logo from our web site but first checks to see whether the file exists and then only downloads it if it's changed since the last time we grabbed it.

var client = new XMLHttpRequest();

client.open("GET", "http://www.digiguide.com/i/nav/banner_gradient.gif", false );

var mail = new File( this.dataFolder + "banner_gradient.gif" );
if( mail.exists )
{
mail.open( "read", "text" )
client.setRequestHeader( "If-Modified-Since", mail.lastModified.toUTCString() );
mail.close();
}

client.send("");

if( client.status == "200" )
{
var mail = new File( this.dataFolder + "banner_gradient2.gif" );
mail.open( "readWrite,replace,create", "text" );
mail.write( client.responseBody );
mail.close();
}
else if( client.status == "304" )
{
lp.writeLog( "Not modified since: " + client.getResponseHeader( "last-modified" ) );
}
else
{
alert( "Failed with error " + client.status + " " + client.statusText );
return false;
}


See Also

  • MultiHTTPRequest


    Requirements

    Build Build 1

    (Last updated: October 12, 2007 15:23:26)

    Error processing SSI file