(1) $.ajax请求后台,后台总结错误信息后write到前提,chrome 遨游 正常火狐弹出 [Object Xmldocument] 解决方案

/my-test/src/main/webapp/Template/visit/infoInputDB.jsp
//$.ajax提交
$.ajax({
type : "POST",
url : bathPath + "/OperateDB/test/migration",
data : {
st1DtYuan : $("#st1DtYuan").val(),
et1DtYuan : $("#et1DtYuan").val(),
tbName2 : $("#tbName2").val(),
tbCol2 : $("#tbCol2").val(),
st1DtMu : $("#st1DtMu").val(),
et1DtMu : $("#et1DtMu").val(),
params: params.toString()
},
success : function(data) {
alert(data);
$("#changeData").removeAttr("disabled");
},
error:function(data) {
$("#changeData").removeAttr("disabled");
},
dataType:'text'
});


//my-test/src/main/java/com/cntv/cn/controller/operateDb/OperateDBDataController.java
@ResponseBody
@RequestMapping(value = "/migration")
public void migration(String st1DtYuan,String et1DtYuan,String st1DtMu,String et1DtMu,String tbName2,String tbCol2,
HttpServletRequest request,HttpServletResponse response,
ModelMap model,String params) throws IOException{

PrintWriter pw = response.getWriter();
String result=null;

boolean b = timeOverlap(st1DtYuan,et1DtYuan,st1DtMu,et1DtMu);
if (b) {
result="源区间与目的区间时间存在重叠,请修改!";
}else{
//两个日期区间 之间的日期 保存在列表中
List listYuan = DateUtils.days(st1DtYuan.substring(0,10),et1DtYuan.substring(0,10));
List listMudi = DateUtils.days(st1DtMu.substring(0,et1DtMu.substring(0,10));
DbModel dbmodel = new DbModel(st1DtYuan,tbName2,tbCol2,et1DtMu,parseParamsstr(params),listYuan,listMudi);
try {
result = operateDBService.migration(dbmodel);
} catch (Exception e) {
}
}
pw.write(result);
}

//现象:chrome 遨游 正常。火狐弹出 [Object Xmldocument]。

//1
response.setContentType("text/plain")
//2
在 $.ajax中指定 指定返回类型
dataType:'text'

相关文章

IE6是一个非常老旧的网页浏览器,虽然现在很少人再使用它,但...
PHP中的count()函数是用来计算数组或容器中元素的个数。这个...
使用 AJAX(Asynchronous JavaScript and XML)技术可以在不...
Ajax(Asynchronous JavaScript and XML)是一种用于改进网页...
本文将介绍如何通过AJAX下载Excel文件流。通过AJAX,我们可以...
Ajax是一种用于客户端和服务器之间的异步通信技术。通过Ajax...