Jump to content
Sign in to follow this  
karwanpro

problem with display data from xml file

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

 

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...