Pushing data to web page

G

Guest

Hi,
i have a server that recieves data often from a third party data provider
often. I would like to PUSH this data to the client webpage, WITHOUT having
to force the user to hit refresh or without having to use client side polling
and autorefresh. Once recieved on the client, i can use something like DHTML
to add it to a table.

Any suggestions on how to go about this or what is the best technology to
use for doing this? Any sample applications out there doing this today?

thank you very much.
 
J

jongalloway

One general approach is to include a hidden IFRAME with a META REFRESH
tag or JavaScript timeout which calls a page on the server. If the data
hasn't changed, the server page returns an empty string. If the server
data has changed, the page returns a Javascript function that updates
the page.

This is the equivalent of client side polling, but without the downside
of page refreshes - it's invisible to the user. I believe GMail does
this now, as well as many web based chat programs.

As far as I know, you can't push data from server to client without
some sort of client side polling mechanism, since browser connections
are stateless and based on server response to client requests.

- Jon
http://weblogs.asp.net/jgalloway
 
J

Joaquin Corchero

Hi,

Using this javascript function:

function GetData(url) {
try{
ob_url = ""
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", url, false);
xmlhttp.send("");
/*var obj =document.getElementById("myspan")
obj.innerText = url;*/
return xmlhttp.responseText;
}catch(err){
return "nothing"
alert(err.description)
}
}

This returns the data that the url that you give to the function would
display, the only one thing is that only works in Internet Explorer.

The only problem with this is where do you want to call the function, for
that you could have a javascript timer of some sort that would do the job,
incrementing the text of an existing object as a <span>, for example...

Joaquin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,159
Messages
2,570,880
Members
47,417
Latest member
DarrenGaun

Latest Threads

Top