I am trying to dynamically update the document title from php script in regular intervals, it seems to not be working. I am a beginner to jquery, please help.
<div id="code" style="border: 1px solid; "></div>
<script>
var blink = true;
setInterval(function(){
if(blink){
jQuery('#code').load('test.php', function(result) {
var theTitle = document.getElementsByTagName("title")[0];
theTitle= 'google'+jQuery('#code').html();
});
//theTitle.text =document.getElementById('code').value;
blink = false;
}else{
jQuery('#code').load('test.php', function(result) {
var theTitle = document.getElementsByTagName("title")[0];
theTitle= 'yahoo'+jQuery('#code').html();
});
blink = true;
}
}, 2000);