下面应该调用Controller类的Ajax函数。控制器没有被调用。仅打印 generateExcel 中的第一个警报。
function generateExcel(bIndex){
alert("Inside generateExcel of export_path -> branchIndex = "+bIndex);
$.ajax({
type:"post",
url:"generate/exportexcel.do?branchIndex="+bIndex,
dataType:"json",
success:function(data){
alert("Inside export_path generateExcel()"+data.length);
}
});
}
控制器:
@RequestMapping("/generate/exportexcel.do")
public String docGeneration(String branchIndex) {
System.out.println("branchIndex ==> " +branchIndex);
try{
DocGenerator.generateExcel(branchIndex, order, filename, categoryDao);
}
catch(Exception e){
e.printStackTrace();
}
return "message/result";
}