By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,718 Members | 1,220 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,718 IT Pros & Developers. It's quick & easy.

Using Javascript to call latest xml file for html display

P: 2
Hi, this is probably fairly straight forward, but I am very new to this so I hope you can help.

I have an html file that reads from an xml data every minute and displays the data. Now I need a way of updating the xml data source file in the html document. The source name takes the file structure 16102006_0045 then 16102006_0046 e.t.c.

i have been told that javascript is the way to do this but can't seem to find any info on it.

here is the struture of the html document

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3.  
  4. <xml id="15102006_1315" src="15102006_1315.xml"></xml>
  5. <meta http-equiv="refresh" content="10;URL=.......ekoner.html">
  6. <table border="1" datasrc="#ekoner">
  7.  
  8. <thead>
  9. <tr><th>Data1</th><th>Data2</th><th>Data3</th><th>Data4</th></tr>
  10. </thead>
  11.  
  12. <tbody>
  13. <tr>
  14. <td><span datafld="Data1"></span></td>
  15. <td><span datafld="Data2"></span></td>
  16. <td><span datafld="Data3"></span></td>
  17. <td><span datafld="Data4"></span></td>
  18. </tr>
  19. </tbody>
  20.  
  21. </table>
  22.  
  23. </body>
  24. </html>
And the xml looks like this

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <dataset>
  3.  <row>
  4. <Data1>1315</Data1>   <Data2>2006-10-11 16:00:00</Data2>   <Data3>Soccer - Fixtures</Data3>   <Data4>Belarus v Slovenia</Data4></row>
  5. </dataset>
  6.  <row>
So that xml document has the name of 15102006_1315.xml and that is referenced in the html document. After 1 minute, a new one is uploaded as 15102006_1516.xml and that now needs to be read in the html document.

Any tips on how to do this best?

Thanks :)
Oct 15 '06 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Read how to import XML using JavaScript. To update, call it every minute using setInterval().
May 23 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.