Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- $.ajax({
- type: "GET",
- url: "instrument.xml",
- dataType: "xml",
- success: function(xml){
- $(xml).find('instrument').each(function(){
- var namn = $(this).find('namn').text();
- var typ = $(this).find('typ').text();
- $(this).find('strangar').each(function(){
- var strang = $(this).find('strang').text();
- var attribut = $(this).find('strang').attr;
- id = "<br /> Strängar: ";
- $(this).find('strang').each(function(index){
- $.each(this.attributes, function() {
- id += strang[index].toUpperCase() + " (" + this.name + " " + this.value +") ";
- });
- });
- $("<h3></h3>").html(namn).appendTo("#accordion");
- $("<div></div>").html(typ + id).appendTo("#accordion");
- $( "#accordion" ).accordion( "refresh" );
- });
- });
- },
- error: function() {
- alert("Det gick inte att skapa xml-filen");
- }
- });
- $( "#accordion" ).accordion();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement