java类中
response.setContentType("text/xml;charset=UTF-8");
StringBuilder sb=new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
sb.append("<result>");
sb.append(result);
sb.append("</result>");
response.getWriter().write(sb.toString());
jsp页面中
$.ajax({
type: "post",
url: url,
dataType:'xml',
success: function(xml){
alert($(xml).find("result").text());
refurbish();
}
});
response.setContentType("text/xml;charset=UTF-8");
StringBuilder sb=new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
sb.append("<result>");
sb.append(result);
sb.append("</result>");
response.getWriter().write(sb.toString());
jsp页面中
$.ajax({
type: "post",
url: url,
dataType:'xml',
success: function(xml){
alert($(xml).find("result").text());
refurbish();
}
});