不知道如何消费XML
或JSON
回应。下面的工作代码。当dataType
is时text
,我得到一个没有或标签的String
响应。但我想消费一个和相同的响应。我应该修复什么才能使其正常工作?XML
JSON
XML
XML
JSON
Code
$.ajax({
type: "GET",
async: false,
//crossDomain: true, //works without crossDomain
dataType: "text",
//dataType: "application/json",
//dataType: "application/xml",
url: 'http://localhost:8080/appName/callMe.xml',
success : function(result) {
//console.error(JSON.stringify(result));
console.log(result);
var ic = document.getElementById('xmlPp');
ic.innerHTML = result;
},
error : function() {
console.error("error");
alert('Not working!');
}
});