【发布时间】:2014-07-17 22:36:32
【问题描述】:
我正在使用 jquery ajax 发送跨域请求。我可以成功发送请求,但是当我收到响应时,控制台中出现语法错误和 XML 处理错误。
var xml_response="http://test.test.in:8080/RestAPI/ServiceRequestServlet?request=<xml><request><functiontype>2003</functiontype><groupzid>185</groupzid><moduleid>8</moduleid><servicetype>21</servicetype></request></xml>"
$(document).ready(function(){
$("#dvContent").append("<ul></ul>");
$.ajax({
type: "GET",
crossDomain: true,
url: xml_response,
dataType: 'jsonp',
success: function(xml){
alert("success");
},
error: function() {
alert("An error occurred while processing XML file.");
}
});
});
我想将响应复制到一个变量,以便我可以解析它并在多选中相应地显示它
【问题讨论】: