function changeTitle(title)
{
document.title = title;
}
function result()
{
var fetchTitle;
fetchTitle = new ActiveXObject("Microsoft.XMLHTTP");
fetchTitle.open("GET", "title.php", true);
fetchTitle.send(null);
}
setInterval('changeTitle(result())', 1000);//check every second for update
title.php
<?php echo "This is a new title"; ?>
It doesn’t seem to change the title. Am I missing something in order for title.php to be displayed?
Thank you.
Many things
resultwhich will always beundefinedasresulthas noreturnstatement.onReadyStateChangeevent handler, so you do nothing with the data returned from the XMLHttpRequest objectI suggest reading an introduction to XMLHttpRequest