views:

74

answers:

1

Hey guys,

i want to parse an xml file with jquery. This works so far, only the output confuses me:) probably you can help me.

$(function(){
  $.get("images.xml",{},function(xml){
    var output = "<ul>";

    $(xml).each(function() {
      smallImage = $(this).find("small").text();
      //bigImage = $(this).find("big").text();

      output += "<li>" + smallImage + "</li>";
      output += "</ul>";
    });

    $("#wrapper").append(output);
  });
});

I want to have each image link in a separate line, until now all links are together in one. Thanks for your help.

A: 

put also the type of the get request as xml;

$(function(){
    $.get("images.xml",{},function(xml){
        var output = "<ul>";
        $(xml).each(function() {
        smallImage = $(this).find("small").text();
        //bigImage = $(this).find("big").text();
        output += "<li>" + smallImage + "</li>";
        output += "</ul>";
    });
    $("#wrapper").append(output);
} ,'xml');
});
Elzo Valugi
thanks, but they still remain in the same tag/line.
each() function needs some parameters.. is there where you are wrong. if I have time I'll make an example.. but I cant promise too much
Elzo Valugi
that would be great :) thank you. hope you'll have time :)