Posted By

joshharbaugh on 08/14/10


Tagged

ajax jquery


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

roli000
drifterz28
NerdyDillinger
mmcachran


Parsing XML with JQuery's AJAX


 / Published in: jQuery
 

A snippet setup to grab an XML file, parse it, and return the data contained within.

  1. jQuery.ajax({
  2. type: "GET",
  3. url: "dates.xml",
  4. dataType: "xml",
  5. success: function(xml) {
  6. jQuery(xml).find('date').each(function(){
  7. date = jQuery(this).find('value').text();
  8. var output = '<span class="date">'+date+'</span>';
  9. jQuery('body').append(jQuery(output));
  10. });
  11. }
  12. });

Report this snippet  

You need to login to post a comment.