简体   繁体   中英

Get all nodes of an XML file without knowing the tag names

I'm trying to load a url of an xml file into my page then use jQuery or ajax to load the 'text' from the xml into a string. I do not know the attributes. I've been trying this so far and it hasn't been working out:

$(document).read(function){
                    $.get(infile, function(xml){
                    string = $(xml).text());
                    }
                }); 

                document.getElementById("input").innerHTML = string;

Any ideas?

Your script has many errors. Try this:

$(document).ready(function(){
                $.get(infile, function(xml){
                  $("#input").text(xml);
                });
            }); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM