Click here to Skip to main content
16,020,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
function GetData()
 {
  var objXML,bNewData,strUserID,strCoID,strAdmin;
  var strUserName,bNewData;
  var strSQL,objNode,xmlDoc;
  var xmlhttp;
  var objNode,objNodes;
  strUserID = Form1.txtUserID.value;
  strCoID= Form1.txtCoID.value;
  strAdmin= Form1.chkIsAdmin.checked;
  doClearTable(document.all.tblUsers);
  strSQL = 'url';
  bNewData = false;
  if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
   else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
   xmlhttp.open("GET",strSQL,false);
   xmlhttp.send();
 xmlDoc=xmlhttp.responseXML;
   objNodes=xmlhttp.evaluate(xmlDoc,xmlhttp,null,null,null);
   for(objNode=0; objNode<objNodes.length; objNode++)
   {
        strUserName=objNodes[objNode].selectSingleNode("UserName").text;
        strUserID=objNodes[objNode].selectSingleNode("ID").text;
        doAddSingleUserRow(strUserName,tblUsers,strUserID);
    }
 }

//

Above Javascript method is working fine in IE but not working in Firefox.

If anyone can solve? In Firefox, ResponseXML gives undefined.
Posted
Updated 24-Oct-10 20:54pm
v2

Replace "xmlhttp.responseXML" by "xmlHttp.responseText"
 
Share this answer
 
Well, your implementation of XMLHttprequest is not entirely complete. You need to check for various status before trying to access/use the responseXML.

Have a look at these links to know more about the implementation and various checks that should be there:
XMLHttpRequest Object[^]
XMLHTTPRequest with Sample[^]
Using the XML HTTP Request object[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900