I have a page that uses Javascript in which I need to have a function that listens for data to be received from the server. Basically, anytime it hits the server, I need the function to fire.
This seems like it would be pretty straightforward - but so far nothing I've tried works.
I know I have the basic set-up correct - because I can get it to listen for mouse up, mouse down, and load - but nothing for when it sends or receives data from the server.
For example, this works...
document.attachEvent('onmouseup', function(event) {
alert("mouse released!");
});
So does this...
window.attachEvent('onload', function(event) {
alert("page loaded!");
});
However, none of these do...
document.attachEvent('onreceive', function(event) {
alert("data received!");
});
window.attachEvent('onreceive', function(event) {
alert("data received!");
});
document.attachEvent('onpost', function(event) {
alert("data posted!");
});
window.attachEvent('onpost', function(event) {
alert("data posted!");
});
document.attachEvent('onmessage', function(event) {
alert("data posted!");
});
window.attachEvent('onmessage', function(event) {
alert("data posted!");
});
Any suggestions?
Thanks in advance!