<div class="grid--cell fl1 lh-lg">
<div class="grid--cell fl1 lh-lg">
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, <a href="/help/reopen-questions">visit the help center</a>.
</div>
</div>
</div>
<div class="grid--cell mb0 mt8">Closed <span title="2013-03-07 07:46:45Z" class="relativetime">7 years ago</span>.</div>
</div>
</aside>
I am using the follwing code to refresh the div but its not working please guide
<script src="moniter.js" type="text/javascript"></script>
<body onLoad="moniter();">
<div id="moniter">
<?php echo rand() ; ?>
</div>
</body>
and js file is
var xmlHttp_moniter
function moniter()
{
xmlHttp_moniter = GetXmlHttpObject_parcel()
if(xmlHttp_moniter == null)
{
alert("browser does not support HTTP Request")
return
}
var url="moniter.php?random=" + Maths.random()
xmlHttp_moniter.onreadystatechange = stateChanged
xmlHttp_moniter.open("GET",url,true)
xmlHttp_moniter.send(null)
}
function stateChanged()
{
if(xmlHttp_moniter.readyState==4 || xmlHttp_moniter.readyState == "complete")
{
document.getElementById("moniter").innerHTML = xmlHttp_moniter.responseText
setTimeout('moniter()',100);
}
}
function GetXmlHttpObject_parcel()
{
var xmlHttp_moniter=null;
try
{
xmlHttp_moniter=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp_moniter=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp_moniter=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp_moniter;
}
</div>
You have a typo. Try to replace Maths.random()
with Math.random()
and code should work as expected.
$('#urDivID').trigger('create');