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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • panos100m
    New Member
    • Aug 2007
    • 23

    #1

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

    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

    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>";
    
    ?>
    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
  • panos100m
    New Member
    • Aug 2007
    • 23

    #2
    that was a caching issue .. is fixed now ;)

    Comment

    • gits
      Recognized Expert Moderator Expert
      • May 2007
      • 5390

      #3
      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

      Comment

      Working...