I am making an ajax request for an xml file but getting a parse error because of the xml declaration.
AJAX request:
<script>
$(document).ready(function(){
$.ajax({
url: "/test/test.xml",
dataType: "xml",
password: "*******",
username: "[email protected]",
success:function( result){
console.log(result);
},
error: function(xhr, status, error){
console.log(error);
console.log(status);
}
});
});
</script>
Response:
<?xml version="1.0" encoding="UTF-8"?>
<token>
<guid>c93f12c71bec27843c1d84b3bdd547f3</guid>
<id type="integer">1</id>
</token>
I get a parse error on the first line of the xml. In prod I'll be requesting an xml file that looks just like this . I tried a test and removed the xml declaration and it worked fine but I will not have control over the xml declaration in the real environment.
Any help would be greatly appreciated
encoding="UTF-8"and?>. Likeencoding="UTF-8" ?>. See: xmlwriter.net/xml_guide/xml_declaration.shtml