Jump to content

problem with display data from xml file


karwanpro

Recommended Posts

hi friend i am used the java script to display the currency of Iraqi dinars from this xml file

http://www.xe.com/datafeed/samples/sample-xml-usd.xml

and i used this code

 

<script>if (window.XMLHttpRequest)  {  xmlhttp=new XMLHttpRequest();  }else  {  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");  }xmlhttp.open("GET","http://www.xe.com/datafeed/samples/sample-xml-usd.xml",false);xmlhttp.send();xmlDoc=xmlhttp.responseXML; currency=xmlDoc.getElementsByTagName("crate")[65].childNodes[0].nodeValue;document.write(currency);</script>

but that is not work and i don't know why?

please tell me what is my mistakes ... help me

 

Link to comment
Share on other sites

what is happening? Are you checking for errors in your console? Checking the networks tab to see that the request goes out and comes back successfully?

 

Are you sure each part of this line is correct?

xmlDoc.getElementsByTagName("crate")[65].childNodes[0].nodeValue;

have you confirmed each part building it up piece by piece to make sure that nodeValue exists where you expect it?

Link to comment
Share on other sites

i just gave you about three things to try. answer those questions and I will be able to help you more.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...