get xml value based on attribute with jquery

get xml value based on attribute with jquery

I want to get all the values of the items where the name="id" and append these values to the div to be used for future purposes.

I have the following XML:

Pastebin link

and this is my jQuery:

$.ajax({ url: "http://test.be/", type: "POST", dataType: "xml", data: soapMessage2, crossDomain: true, contentType: "text/xml; charset=\"UTF-8\"", success: function(xml) { $(xml).find('item[name="id"]').each(function() { var libr = $(this).text(); $('#lib').append('<p><a href="#">' + libr + '</a></p>'); }); } });

I can't seem to find why nothing gets added to the div. Any help would be appreciated. Thanks in advance.