我正在使用JSONP进行api跨域请求,外部服务器以XML格式返回结果,下面是我的代码:
$.ajax({
type: "Get",
url: "http://domain.com/function?Data=1234567890",
xhrFields: {withCredentials: true},
dataType: "JSONP text xml",
contentType: "application/xml",
cache: false,
success: function(xml)
{
alert($(this).find('ResponseStatus').text());
}
});
Run Code Online (Sandbox Code Playgroud)
它返回给我一个xml,但随之而来的是它会产生一个错误,说"Unexpected token <",它不幸地停止了我的处理,我没有收到警告信息.任何的想法?
最好