Hi All,
I am using Ajax inorder to retrieve a data from the db which is an xml and i am parsing the responseText into an xml. the code what i had tried is working well with IE, but the same makes a lot of trouble in mozilla any help would be greatful
the following is the code
[HTML] if (httpRequest.readyState == 4)
{
if(httpRequest.status == 200)
{
var pricingSummaryXML = httpRequest.responseText;
alert("Pricing Summary XML = "+pricingSummaryXML);
var xmlDoc = newXMLDoc(pricingSummaryXML);
alert("XML Doc = "+xmlDoc);
if(xmlDoc != null)
{
var root = xmlDoc.getElementsByTagName("response")[0]; //This line shows Error[/HTML]
[HTML]function newXMLDoc(xmlData)
{
var xmlDoc = null;
try { //Internet Explorer
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
alert("Inside 1");
xmlDoc.loadXML(xmlData);
}
catch(e)
{
try {
//Firefox, Mozilla, Opera, etc.
parser=new DOMParser();
alert("Inside 2")
xmlDoc=parser.parseFromString(xmlData,"text/xml");
}
catch(e) {
alert(e.message);
return null;
}
}
return xmlDoc;
} [/HTML]
In mozilla I am getting an exception with the description root is null, i tried it by displaying its length, it shows 0. I replaced the responseText with the XML directly what I am retrieveing from db it works but i want in the responseText only. Please i need some suggestions
Regards
Ramanan Kalirajan