小编ada*_*723的帖子

跨域JSONP XML响应

我正在使用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 <",它不幸地停止了我的处理,我没有收到警告信息.任何的想法?

最好

xml ajax jquery jsonp

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

ajax ×1

jquery ×1

jsonp ×1

xml ×1