By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Ajax function doesnt seem to work under IE but works in mozilla

P: 23
Hi on page load a javascript functions (timedCount()) is executed (timer) which executes another javascript function (ajax function:findprov(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="javascript" type="text/javascript">
{literal}
var c=0;
var t;
window.onload = function(){



timedCount();
}

function timedCount()
{

t=setTimeout("timedCount()",3000);
findprov('tes');
}



var xmlHttp


function findprov(divtowrite)
{
DTW=divtowrite;


xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}



var url="tstudents.php";
xmlHttp.onreadystatechange=stateChanged


xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{



document.getElementById(DTW).innerHTML=xmlHttp.res ponseText ;

}
}function GetXmlHttpObject()
{
var xmlHttp=null;try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
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

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.  
  4. define('AT_INCLUDE_PATH','../');
  5. include_once (AT_INCLUDE_PATH.'include/ini.php');
  6.  
  7.  
  8. $students = new DataObjects_stu;
  9. $students->query("select * from {$students->__table} ");
  10.  
  11.  
  12.  
  13. $students->whereAdd("Id != 12345678900 ");
  14.  
  15.  
  16. $number_of_rows = $students->find();
  17.  
  18. echo "<font color=blue> <b>". $number_of_rows." </b> students  </font>";
  19.  
  20. ?>
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
Sep 30 '08 #1
Share this Question
Share on Google+
2 Replies


P: 23
that was a caching issue .. is fixed now ;)
Sep 30 '08 #2

gits
Expert Mod 5K+
P: 5,235
that is often the case ;) ... typically you add a unique param to the request to avoid caching ... perhaps you could just drop a short note about your solution here so that users with similar problems in the future will see how they could fix such issues?

kind regards
Sep 30 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.