1 Reply Latest reply on Sep 18, 2007 6:23 PM by Flashcqxg

    what's the problem with this Ajax code?

    Flashcqxg
      The B.cfm:
      <cfimport taglib="/tags" prefix="Tag">
      <Tag:_ImportprocessingTime> <!--- This tag show the time spended--->
      do some long loop...... <!--- this only needs about 5 seconds--->
      </Tag:_ImportprocessingTime>

      the ajax code to execute the b.cfm:
      function Importxls(url,buttonid,msgid,dbffilename)
      {
      createXMLHttpRequest();
      var url=url+"?importdbffilename="+dbffilename+"&ti="+new Date().getTime();
      xmlHttp.open("GET",url,true);
      xmlHttp.onreadystatechange= function()
      {
      if (xmlHttp.readyState < 4)
      {
      document.getElementById(msgid).innerHTML= "importing......";
      document.getElementById(buttonid).disabled=true;
      }
      else if (xmlHttp.readyState == 4)
      {
      if(xmlHttp.status == 200)
      {
      document.getElementById(msgid).innerHTML=xmlHttp.responseText;
      document.getElementById(buttonid).disabled=false;
      }
      else if (xmlHttp.status == 404)
      {
      document.getElementById(msgid).innerHTML="URL error";
      document.getElementById(buttonid).disabled=false;
      }
      else
      {
      document.getElementById(msgid).innerHTML="error,xmlHttp state:"+xmlHttp.status+"。";
      document.getElementById(buttonid).disabled=false;
      }
      }
      };
      xmlHttp.send(null);
      }


      when I execute the b.cfm ,the spended time only about 5 seconds and show the result right now.
      but when I execute the b.cfm through the ajax code,after about 60 seconds,it shows the result,why?and how to let it show the result after the b.cfm executed?

      Thanks a lot.