I am trying to get xml values into javascript I have been trying to get xml values through javascript and it is working fine in IE but not in firefox.
here are the javascript code
Expand|Select|Wrap|Line Numbers
- var xmlreq = false;
- //xmlreq =document.implementation.createDocument("","",null);
- xmlreq = new ActiveXObject("Microsoft.XMLDOM");
- var xmlFile="/val/valid.xml";
- var vale="";
- xmlreq.async="false";
- xmlreq.onreadystatechange=verify();
- xmlreq.load(xmlFile);
- var xmlDoc =xmlreq.documentElement;
- vale=xmlDoc.getElementsByTagName('firstcheck')[0].firstChild.nodeValue;
- // i need to get the values from xml to this variable "vale"
- function verify() {
- if (xmlreq.readyState != 4) {
- return false;
- }
- alert(xmlreq.readyState);
- }
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <validationcheck>
- <firstcheck>check</firstcheck>
- <firstcheck>venki</firstcheck>
- </validationcheck>
xmlreq =document.implementation.createDocument("","",null );
but after load,
xmlreq.load(xmlFile);
var xmlDoc =xmlreq.documentElement;
if i alert xmlDoc
it gives null , and error is xmldoc has no properties.please help me