我正在调用一个返回XML有效负载的内部REST服务,如下所示。尽管服务器日志返回200和XML有效负载,但似乎没有在前端呈现任何内容。下面是jQuery。 Firefox调试控制台表示200也不认为这里涉及CORS。我已经尝试将dataType更改为XML,然后尝试序列化也不起作用。任何建议都将不胜感激。
var rootURL = "http://mydomain:8999/";
function findByName(searchKey) {
console.log('findByName: ' + searchKey);
$.ajax({
type: "GET",
url: rootURL + searchKey,
//contentType: "text/xml",
dataType: "text",
processData: false,
//contentType: "text/xml; charset=\"utf-8\"",
success: renderList,
failure: function(errMsg) {
console.log('errMsg: ' + errMsg);
alert(errMsg);
}
});
}
function renderList(data) {
console.log("Hello There: ");
$('#data').append(data);
}
从Firefox调试控制台:
GET http://mydomain:8999/4 [HTTP/1.1 200 OK 571ms]
09:15:07.393 "findByName: 4"
服务器返回的XML Payload
<CUSTOMER xmlns:xlink="http://www.w3.org/1999/xlink">
<ID>3</ID>
<FIRSTNAME>Michael</FIRSTNAME>
<LASTNAME>Clancy</LASTNAME>
<STREET>542 Upland Pl.</STREET>
<CITY>San Francisco</CITY>
</CUSTOMER>