Hi on page load a javascript functions (timedCount()) is executed (timer) which executes another javascript function (ajax function:findpr ov(divtowrite) ) in turn this calls a php file to query a database and produce the total number of records.
It works under mozilla but not ie
the tpl file::
[HTML]</html>
<head>
<script language="javas cript" type="text/javascript">
{literal}
var c=0;
var t;
window.onload = function(){
timedCount();
}
function timedCount()
{
t=setTimeout("t imedCount()",30 00);
findprov('tes') ;
}
var xmlHttp
function findprov(divtow rite)
{
DTW=divtowrite;
xmlHttp=GetXmlH ttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="tstudents. php";
xmlHttp.onready statechange=sta teChanged
xmlHttp.open("G ET",url,true)
xmlHttp.send(nu ll)
}
function stateChanged()
{
if (xmlHttp.readyS tate==4 || xmlHttp.readySt ate=="complete" )
{
document.getEle mentById(DTW).i nnerHTML=xmlHtt p.responseText ;
}
}function GetXmlHttpObjec t()
{
var xmlHttp=null;tr y
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest( );
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(" Msxml2.XMLHTTP" );
}
catch (e)
{
xmlHttp=new ActiveXObject(" Microsoft.XMLHT TP");
}
}
return xmlHttp;
}
{/literal}
</script>
<meta http-equiv="Content-Language" content="en-gb">
</head>
<body>
<table border="0" width="100%" id="table1">
<tr>
<p> <span id="tes"> </span> </p></td>
</tr>
</table>
</body>
</html>[/HTML]
the php file tstudents.php
In both cases (mozilla and ie) the number of records is retrieved so the db query is ok .. the difference is that in mozilla is updated when a record is added but in ie is not ..(tried with ie7,ie8)
Any help will be appreciated
Thanks
It works under mozilla but not ie
the tpl file::
[HTML]</html>
<head>
<script language="javas cript" type="text/javascript">
{literal}
var c=0;
var t;
window.onload = function(){
timedCount();
}
function timedCount()
{
t=setTimeout("t imedCount()",30 00);
findprov('tes') ;
}
var xmlHttp
function findprov(divtow rite)
{
DTW=divtowrite;
xmlHttp=GetXmlH ttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="tstudents. php";
xmlHttp.onready statechange=sta teChanged
xmlHttp.open("G ET",url,true)
xmlHttp.send(nu ll)
}
function stateChanged()
{
if (xmlHttp.readyS tate==4 || xmlHttp.readySt ate=="complete" )
{
document.getEle mentById(DTW).i nnerHTML=xmlHtt p.responseText ;
}
}function GetXmlHttpObjec t()
{
var xmlHttp=null;tr y
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest( );
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(" Msxml2.XMLHTTP" );
}
catch (e)
{
xmlHttp=new ActiveXObject(" Microsoft.XMLHT TP");
}
}
return xmlHttp;
}
{/literal}
</script>
<meta http-equiv="Content-Language" content="en-gb">
</head>
<body>
<table border="0" width="100%" id="table1">
<tr>
<p> <span id="tes"> </span> </p></td>
</tr>
</table>
</body>
</html>[/HTML]
the php file tstudents.php
Code:
<?php
define('AT_INCLUDE_PATH','../');
include_once (AT_INCLUDE_PATH.'include/ini.php');
$students = new DataObjects_stu;
$students->query("select * from {$students->__table} ");
$students->whereAdd("Id != 12345678900 ");
$number_of_rows = $students->find();
echo "<font color=blue> <b>". $number_of_rows." </b> students </font>";
?>
Any help will be appreciated
Thanks
Comment