Error: Unknown runtime error in ie while using ajax

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vjayis
    New Member
    • Mar 2008
    • 134

    Error: Unknown runtime error in ie while using ajax

    hi
    when i m trying to fetch data from one page to another page using ajax, i get an error message in IE., but it runs well in firefox., could anyone help me.,

    here is my javascript code.,

    [HTML]<script type="text/javascript">
    var id;
    var action;
    function httprequest(id, action)
    {

    var xmlhttp;
    try
    {
    xmlhttp=new XMLHttpRequest( );
    }
    catch(e)
    {
    try
    {
    xmlhttp=new Activexobject(" Msxml2.XMLHTTP" );
    }
    catch(e)
    {
    try
    {
    xmlhttp=new Activexobject(" MICROSOFT.XMLHT TP")
    }
    catch(e)
    {
    alert("ur browser doesnot support Ajax");
    return false;
    }
    }

    }
    xmlhttp.onready statechange=fun ction()
    {
    if(xmlhttp.read yState==4)
    {
    document.getEle mentById("ajax" ).innerHTML=xml http.responseTe xt;
    }
    }

    xmlhttp.open("G ET","url/"ajax.php?id="+ id+"&action="+a ction,true);
    xmlhttp.send(nu ll);
    }

    function hidden(id,actio n)
    {
    httprequest(id, action)
    }
    </script>

    <table id="ajax">------Place where i fetch data from another page and display---------
    <tr><td><a onclick="hidden ('1','next')">n ext</a></td></tr>
    </table>
    [/HTML]

    Could anyone help me.,
    Thanks.,
    vijay
    Last edited by gits; Mar 19 '08, 09:32 AM. Reason: added code tags
  • vjayis
    New Member
    • Mar 2008
    • 134

    #2
    Error: Unknown runtime error in ie while using ajax

    hi
    when i m trying to fetch data from one page to another page using ajax, i get an error message in IE., but it runs well in firefox., could anyone help me.,

    here is my javascript code.,

    [HTML]<script type="text/javascript">
    var id;
    var action;
    function httprequest(id, action)
    {

    var xmlhttp;
    try
    {
    xmlhttp=new XMLHttpRequest( );
    }
    catch(e)
    {
    try
    {
    xmlhttp=new Activexobject(" Msxml2.XMLHTTP" );
    }
    catch(e)
    {
    try
    {
    xmlhttp=new Activexobject(" MICROSOFT.XMLHT TP")
    }
    catch(e)
    {
    alert("ur browser doesnot support Ajax");
    return false;
    }
    }

    }
    xmlhttp.onready statechange=fun ction()
    {
    if(xmlhttp.read yState==4)
    {
    document.getEle mentById("ajax" ).innerHTML=xml http.responseTe xt;
    }
    }

    xmlhttp.open("G ET","url/"ajax.php?id="+ id+"&action="+a ction,true);
    xmlhttp.send(nu ll);
    }

    function hidden(id,actio n)
    {
    httprequest(id, action)
    }
    </script>


    <table id="ajax">------Place where i fetch data from another page and display---------
    <tr><td><a onclick="hidden ('1','next')">n ext</a></td></tr>
    </table>


    [/HTML]
    Could anyone help me.,
    Thanks.,
    vijay
    Last edited by acoder; Mar 19 '08, 08:50 PM. Reason: Added code tags

    Comment

    • vjayis
      New Member
      • Mar 2008
      • 134

      #3
      Error: Unknown runtime error in ie

      hi
      when i m trying to fetch data from one page to another page using ajax, i get an error message in IE., but it runs well in firefox., could anyone help me.,

      here is my javascript code.,
      Code:
      <script type="text/javascript">
      var id;
      var action;
      function httprequest(id,action)
      {
      
      var xmlhttp;
      try
      {
      xmlhttp=new XMLHttpRequest();
      }
      catch(e)
      {
      try
      {
      xmlhttp=new Activexobject("Msxml2.XMLHTTP");
      }
      catch(e)
      {
      try
      {
      xmlhttp=new Activexobject("MICROSOFT.XMLHTTP")
      }
      catch(e)
      {
      alert("ur browser doesnot support Ajax");
      return false;
      }
      }
      
      }
      xmlhttp.onreadystatechange=function()
      {
      if(xmlhttp.readyState==4)
      {
      document.getElementById("ajax").innerHTML=xmlhttp.responseText;
      }
      }
      
      xmlhttp.open("GET","url/"ajax.php?id="+id+"&action="+action,true);
      xmlhttp.send(null);
      }
      
      function hidden(id,action)
      {
      httprequest(id,action)
      }
      </script>
      
      
      <table id="ajax">------Place where i fetch data from another page and display---------
      <tr><td><a onclick="hidden('1','next')">next</a></td></tr>
      </table>
      Could anyone help me.,
      Thanks.,
      vijay
      Last edited by ronverdonk; Mar 19 '08, 12:18 PM. Reason: code tags!

      Comment

      • rpnew
        New Member
        • Aug 2007
        • 189

        #4
        Originally posted by vjayis
        hi
        when i m trying to fetch data from one page to another page using ajax, i get an error message in IE., but it runs well in firefox., could anyone help me.,

        here is my javascript code.,

        <script type="text/javascript">
        var id;
        var action;
        function httprequest(id, action)
        {

        var xmlhttp;
        try
        {
        xmlhttp=new XMLHttpRequest( );
        }
        catch(e)
        {
        try
        {
        xmlhttp=new Activexobject(" Msxml2.XMLHTTP" );
        }
        catch(e)
        {
        try
        {
        xmlhttp=new Activexobject(" MICROSOFT.XMLHT TP")
        }
        catch(e)
        {
        alert("ur browser doesnot support Ajax");
        return false;
        }
        }

        }
        xmlhttp.onready statechange=fun ction()
        {
        if(xmlhttp.read yState==4)
        {
        document.getEle mentById("ajax" ).innerHTML=xml http.responseTe xt;
        }
        }

        xmlhttp.open("G ET","url/"ajax.php?id="+ id+"&action="+a ction,true);
        xmlhttp.send(nu ll);
        }

        function hidden(id,actio n)
        {
        httprequest(id, action)
        }
        </script>


        <table id="ajax">------Place where i fetch data from another page and display---------
        <tr><td><a onclick="hidden ('1','next')">n ext</a></td></tr>
        </table>



        Could anyone help me.,
        Thanks.,
        vijay
        Hi,

        What is the error that you are getting??

        Regards,
        RP

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          Please enclose your posted code in [code] tags (See How to Ask a Question).

          This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

          Please use [code] tags in future.

          This is not a PHP question, but a JavaScript one.

          This thread will be moved to the JS forum.

          moderator

          Comment

          • hsriat
            Recognized Expert Top Contributor
            • Jan 2008
            • 1653

            #6
            [code=javascript]xmlhttp.open("G ET", "ajax.php?i d=" + id + "&action=" + action, true);[/code]

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Threads merged. Please do not double post your questions.

              Moderator.

              Comment

              • vjayis
                New Member
                • Mar 2008
                • 134

                #8
                Originally posted by rpnew
                Hi,

                What is the error that you are getting??

                Regards,
                RP
                hi Rp.,

                when i click on the ajax link("Next") i get an error displaying tht:
                Error: Unknown runtime error;

                thts it.,

                thanks.,
                vijay

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  You have an extra double quote in the URL string:
                  Code:
                  "url/"ajax.php?id="+id+"&action="+action
                  instead of
                  Code:
                  "url/ajax.php?id="+id+"&action="+action

                  Comment

                  • vjayis
                    New Member
                    • Mar 2008
                    • 134

                    #10
                    Originally posted by acoder
                    You have an extra double quote in the URL string:
                    Code:
                    "url/"ajax.php?id="+id+"&action="+action
                    instead of
                    Code:
                    "url/ajax.php?id="+id+"&action="+action

                    hi

                    sorry for the mistake.,

                    i hav written
                    Code:
                    "url/ajax.php?id="+id+"&action="+action
                    [/QUOTE] like this only.,

                    instead of giving the full link i just typed it inside the quoutes to replace my web link., just to highlight the link.,

                    I replace my full code one more time.,


                    Code:
                    <script type="text/javascript">
                    var id;
                    var action;
                    function httprequest(id,action)
                    {
                    
                    var xmlhttp;
                    try
                    {
                     xmlhttp=new XMLHttpRequest();
                    }
                    catch(e)
                    {
                      try
                      {
                      xmlhttp=new Activexobject("Msxml2.XMLHTTP");
                      }
                      catch(e)
                      { 
                        try
                    	{
                        xmlhttp=new Activexobject("MICROSOFT.XMLHTTP")
                    	}
                    	catch(e)
                    	{
                    	 alert("ur browser doesnot support Ajax");
                    	 return false;
                    	}
                      }
                      
                    }
                    xmlhttp.onreadystatechange=function()
                    { 
                     if(xmlhttp.readyState==4)
                     { 
                       
                       obj = document.getElementById( "ajax" );
                       
                       obj.innerHTML = xmlhttp.responseText;
                       getBufferText();
                       
                     }
                    }
                    
                    xmlhttp.open("GET", "url/ajax.php?id=" + id + "&action=" + action, true);
                    xmlhttp.send(null);
                    }
                    
                    function hidden(id,action)
                    {
                     httprequest(id,action)
                    }
                    </script>
                    [code-php]

                    <table id="ajax">------Place where i fetch data from another page and display---------
                    <tr><td><a onclick="hidden ('1','next')">n ext</a></td></tr>
                    </table>

                    [/code]
                    thanks

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      #11
                      Which line does the error occur on?

                      Comment

                      • vjayis
                        New Member
                        • Mar 2008
                        • 134

                        #12
                        Originally posted by acoder
                        Which line does the error occur on?
                        Hi

                        got solution for the problem.,

                        tried using div tag from the suggestion gave by "gits" in another forum.,

                        But when the page loads i get an error (only in ie which runs well in firefox)

                        Error: 'document.getEl ementById(...)' is null or not an object.

                        can u give me some t ips.,

                        thanks

                        Comment

                        • acoder
                          Recognized Expert MVP
                          • Nov 2006
                          • 16032

                          #13
                          I assume the error occurs on the following line:
                          Code:
                          obj = document.getElementById( "ajax" );
                          Try using a different ID in case IE has a problem with the "ajax" id.

                          Failing that, is it possible that you have a test page?

                          Comment

                          • vjayis
                            New Member
                            • Mar 2008
                            • 134

                            #14
                            Originally posted by acoder
                            I assume the error occurs on the following line:
                            Code:
                            obj = document.getElementById( "ajax" );
                            Try using a different ID in case IE has a problem with the "ajax" id.

                            Failing that, is it possible that you have a test page?


                            Hi
                            sorry i couldnt send u a test page.,

                            Can u tell me whether ajax can be run in ie5 and ie6.,

                            coz my ajax script is not running in an system which has ie6 installed., i hav tried even by enabling most of the options in browser settings.,

                            here is my javascript coding

                            [code=javascript]
                            function httprequest()
                            {

                            var xmlhttp;
                            try
                            {
                            xmlhttp=new XMLHttpRequest( );
                            }
                            catch(e)
                            {
                            try
                            {
                            xmlhttp=new ActiveXObject(" Msxml2.XMLHTTP" );
                            }
                            catch(e)
                            {
                            try
                            {
                            xmlhttp=new ActiveXObject(" MICROSOFT.XMLHT TP")
                            }
                            catch(e)
                            {
                            alert("ur browser doesnot support Ajax");
                            return false;
                            }
                            }

                            }
                            ------------------------------
                            }[/code]


                            when i click on the ajax link i got an alert message "ur browser doesnot support Ajax" which i hav given in the script.,

                            Thanks
                            Last edited by acoder; Mar 24 '08, 06:27 PM. Reason: fixed code tag

                            Comment

                            • acoder
                              Recognized Expert MVP
                              • Nov 2006
                              • 16032

                              #15
                              Originally posted by vjayis
                              Can u tell me whether ajax can be run in ie5 and ie6.,
                              Yes, it can. You may need to watch the case - see if this link helps.

                              Comment

                              Working...