jQuery XML manipulation NOT WORKING in Internet Explorer

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Feb 2008
Posts: 99
Reputation: Clawsy is an unknown quantity at this point 
Solved Threads: 5
Clawsy Clawsy is offline Offline
Junior Poster in Training

jQuery XML manipulation NOT WORKING in Internet Explorer

 
0
  #1
Aug 14th, 2009
Hello,

I manipulate XML with jQuery with no problem in all browseres but not in Internet Explorer. I serched bug-fix and I found "metadata.js" but still not working in my Internet Explorer 7 .

Does anyone now a fix for this problem? It's just too nice to manipulate XML with jQuery...


As a matter of fact... a simple example of extracting some data:
Script page:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <!DOCTYPE html PUBLIC "-//W3C// DTD HTML 4.01//EN"
  2. "http://www.w3.org/TR/html4/strict.dtd">
  3. <html>
  4. <head>
  5. <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
  6. <title>Address book</title>
  7. <script src="jquery.js" type="text/javascript"></script>
  8. <script src="metadata.js" type="text/javascript"></script>
  9.  
  10. <script type="application/javascript">
  11. $(function() {
  12. $('#update-target a').click(function() {
  13. $.ajax({
  14. type: "GET",
  15. url: "labels.xml",
  16. dataType: "xml",
  17. success: function(xml) {
  18. $(xml).find('label').each(function(){
  19. var id_text = $(this).attr('id')
  20. var name_text = $(this).find('name').text()
  21.  
  22. $('<li></li>')
  23. .html(name_text + ' (' + id_text + ')')
  24. .appendTo('#update-target ol');
  25. }); //close each(
  26. }
  27. }); //close $.ajax(
  28. }); //close click(
  29. }); //close $(
  30. </script>
  31. </head>
  32. <body>
  33. <p>
  34. <div id='update-target'>
  35. <a href="#">Click here to load addresses</a>
  36. <ol></ol>
  37. </div>
  38. </p>
  39. </body>
  40. </html>

labels.xml file:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <labels>
  3. <label id='ep' added="2003-06-10">
  4. <name>Ezra Pound</name>
  5. <address>
  6. <street>45 Usura Place</street>
  7. <city>Hailey</city>
  8. <province>ID</province>
  9. </address>
  10. </label>
  11. <label id='tse' added="2003-06-20">
  12. <name>Thomas Eliot</name>
  13. <address>
  14. <street>3 Prufrock Lane</street>
  15. <city>Stamford</city>
  16. <province>CT</province>
  17. </address>
  18. </label>
  19. <label id="lh" added="2004-11-01">
  20. <name>Langston Hughes</name>
  21. <address>
  22. <street>10 Bridge Tunnel</street>
  23. <city>Harlem</city>
  24. <province>NY</province>
  25. </address>
  26. </label>
  27. <label id="co" added="2004-11-15">
  28. <name>Christopher Okigbo</name>
  29. <address>
  30. <street>7 Heaven's Gate</street>
  31. <city>Idoto</city>
  32. <province>Anambra</province>
  33. </address>
  34. </label>
  35. </labels>
  36.  

Code works perfectly in all browsers except IE (Internet Explorer - "failing forever". Good job MS )
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC