I have created a JavaScript program for parsing XML using JQuery. Below is the code and sample XML. When running this, it is working fine with IE 8. But when I test in Chrome or FireFox, the $.parseXML does load xml. I am not seeing any errors, it just stops. I have put in alerts to see where it is stopping to determine the issue. Can anyone help? I don't understand why jQuery is working in IE 8 and not chrome or Firefox.
XML is simple
<?xml version="1.0" ?>
<userinfo>
<rc>Y</rc>
<un>George</un>
</userinfo>
or
<?xml version="1.0" ?>
<userinfo>
<rc>N</rc>
<un></un>
</userinfo>
Have created a JavaScript Parsing of XML using JQuery but only working in IE 8.
function userLookup( v_page, v_uid, v_pwd )
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange= function(){
if(xmlHttp.readyState==4)
{
var xml = xmlHttp.responseText;
var xmlDoc = $.parseXML( xml );
var $xml = $( xmlDoc );
var $returncode = $xml.find( "rc" );
if($returncode.text() == 'N')
{
alert("Invalid Userid/Password");
}
else if ($returncode.text() == 'Y')
{
document.getElementById('WelcomeMessage').innerHTML = "Welcome " + loginuser;
document.getElementById('dialogLogIn').style.display = 'none';
} else {
alert( $returncode.text() );
}
}
}
xmlHttp.open("GET",v_page+"?v_uid="+v_uid+"&v_pwd="+v_pwd,true);
xmlHttp.send(null);
}