My product produces a web page that has some tables on it. I would like to update the tables every 10 seconds or so. Does anyone know how to automatically update tables without re-loading the entire page (I have background jpgs that take a while to load)?
Yes,
If you don’t mind using javascript that is! You can include a script in the head section of your html to include the script ie
then in the body:
where the statusPoll() issues a XMLHTTPRequest along the lines of:
//create and send the request
if(window.XMLHttpRequest)
{
newAjax.ajaxReq = new XMLHttpRequest();
newAjax.ajaxReq.open('POST', newAjax.url, true);
newAjax.ajaxReq.send(null);
//if we're using IE6 style (maybe 5.5 compatible too)
}
else if(window.ActiveXObject)
{
newAjax.ajaxReq = new ActiveXObject('Microsoft.XMLHTTP');
if(newAjax.ajaxReq)
{
/*
open( method, URL, async )
Specifies the method, URL, and other optional attributes of a request.
The method parameter can have a value of 'GET', 'POST', 'HEAD', 'PUT', 'DELETE',
or a variety of other HTTP methods listed in the W3C specification.
The URL parameter may be either a relative or complete URL.
The 'async' parameter specifies whether the request should be handled asynchronously
or not – 'true' means that script processing carries on after the send() method,
without waiting for a response, and 'false' means that the script waits for a response
before continuing script processing.
*/
newAjax.ajaxReq.open('POST', newAjax.url, true);
newAjax.ajaxReq.send();
}
}
you then need to poll for a responce. Google Ajax / XMLHTTPRequest and you will find examples.
You can use the CGI functionality to create the XML data on the fly, alternatively you can create an XML file that include SSI tags as the data.
Hope this gives you a starting point!
Cheers,
Dave
Thanks. I had some other complications but eventually got it to work.