Friday 11 June 2010 9:47:32 am
Martin, I am thankfull for u to help me . I will explain the scenario. I have created ezflow dynamic blocks and applied overflow . I run cronejob .it is working.But to see the automatic changes (overflow of contents in blcoks without refresh F5,) want to apply some ajax with javascript.hope u understand this. Now i will tell u that javascript I used. U do not mind the whole code.I will bold the code the you need to look at. I hav two files monitor.php and monitor.js <span class="line">this is monitor.js
</span>
// JavaScript Document
var xmlHttp_monitor
function monitor()
{
xmlHttp_monitor = GetXmlHttpObject_parcel()
if(xmlHttp_monitor == null)
{
alert("browser does not support HTTP Request")
return
} var url="monitor.php" ///I will apply the ajax with javascript refresh in this monitor.php by specify file name
xmlHttp_monitor.onreadystatechange = stateChanged
xmlHttp_monitor.open("GET",url,true)
xmlHttp_monitor.send(null)
}
function stateChanged()
{
if(xmlHttp_monitor.readyState==4 || xmlHttp_monitor.readyState == "complete")
{
document.getElementById("monitor").innerHTML = xmlHttp_monitor.responseText
setTimeout('monitor()',100);
}
}
function GetXmlHttpObject_parcel()
{
var xmlHttp_monitor=null;
try
{
xmlHttp_monitor=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp_monitor=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp_monitor=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp_monitor; } monitor.php file is like this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><script src="monitor.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body onload="monitor();"> <div id="monitor"> <?php
$timezone = new DateTimeZone( "Europe/London" );
$date = new DateTime();
$date->setTimezone( $timezone );
echo $date->format( 'H:i:s A / D, M jS, Y' );
?> </div>
</body> </html> What I am trying to do is i am trying to apply the above javascript in my pagelayout.tpl for automatic refesh. I have put the javscript in pagelayout directly by {ldelim}{rdelim} But in javascript file i want to put the file name like u see var url="pagelayout.tpl" it is not working. But I think this is in only case of EZ.When I do the same codes in php and ASP it is working. So any idea about how to put template path or filename, url in javascript.Any help would be appreciable.otherwise I want to try on diffrent javascript code. Thanks in advance.
|