Hi,
I am currently writing a chatprogram, and it works fine in FF but it doesnt refresh as it should every 1500ms (set with setInterval("retrieve_messages()",1500) in body tag) in IE. The object ajax is made in previous code.
I wrote the following code:
function retrieve_messages() {
// Checks wether the object is available:
if (ajax) {
ajax.open('get', 'messageretrieve.php');
// Sends request
ajax.send(null);
// Function that handles response
ajax.onreadystatechange = setTimeout("show_messages()", 500);
} else { // AJAX is not useable
document.getElementById('warning').innerHTML = 'It is not possible to connect, please update your browser.';
}
} // End of retrieve_messages()
// Function that shows the returned text into the messagebox
function show_messages() {
// If everything is OK:
if ( (ajax.readyState == 4) && (ajax.status == 200) ) {
// Returns the value to the document
document.getElementById('messagebox').innerHTML = ajax.responseText;
}
} // End of function show_messages()
IE says that there is something not implemented on line 9 (ajax.onreadystatechange=.....), could somebody help me out?
~Graphix
EDIT: I am currently going to bed, i will be back tomorrow.