I'm trying to get XML data from server, the XML format looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<env:Envelope xmlns:env="httpd://www.w3.org/org/2003/05/spap-envlop" env:encodingStyle="httpd:
//www.w3.org/org/2003/05/spap-envlop">
<env:Body>
<ip>0.0.0.0</ip>
<domain>Website</domain>
</env:Body>
</env:Envelope>
And I can see all the XML data from Google chrome console with $.get method:
$(function() {
$.get("../setup/web.xml", function (data) {
console.log(data)
});
});
In the Google chrome console message, it shows "#document" and a small arrow sign tells me that's a fold up message, then I click the arrow sign, my XML data showed up. But I still can't figure out why can't I get XML tag's text from my code below:
$(function() {
$.get("../setup/web.xml", function (data) {
$("#ip").text(data.ip) //undefined
$("#domain").text(data.domain) //undefined
});
});
Or even this one:
$(function() {
$.get("../setup/web.xml", function (data) {
$(data).find("env:Body").each(function () {
$("#ip").text(ip) //undefined
$("#domain").text(domain) //undefined
}
});
});