/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) {
e.printStackTrace();
}}pw.write(result);
}
//现象:chrome 遨游 正常。火狐弹出 [Object Xmldocument]。
//1
response.setContentType("text/plain")
|
在 $.ajax中指定 指定返回类型
dataType:'text'