Ajax works fine Chrome but gives errors in IE*

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SkyuVa
    New Member
    • Aug 2010
    • 2

    #1

    Ajax works fine Chrome but gives errors in IE*

    IE8 is giving me an Unknown Runtime Error, on the following line.
    Code:
         document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    Here is the complete function.
    Code:
     function showUser(str)
    {
    //str=document.getElementById("users").value;
    //alert(str);
    
    if (str=="")
      {
      document.getElementById("txtHint").innerHTML="";
      return;
      } 
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        }
      }
    xmlhttp.open("GET","ajax_ldap.php?q="+str,true);
    xmlhttp.send();
    }
  • SkyuVa
    New Member
    • Aug 2010
    • 2

    #2
    Solved

    It turns out that the ajax page I was calling has a form in it. Which means that I was inserting a form into a form . Refer to the bottom following link for an in depth explanation.

    Comment

    Working...