spring mvc action接收不到 前台ajax请求问题!! 在线等待中……
前台使用的js ajax方式提交请求,如下代码
function getImgPathByCond()
{
$("#chartPanel").html('<img id="chart" src="images/wait.gif" border="0" usemap="#map" onload="this.style.marginTop=((this.parentElement.offsetHeight-this.offsetHeight)/2);"/>');
var dateType = $(":radio").filter(":checked").val();
var beginDate = $('#chart_start_time').attr('value');
var endDate = $('#chart_end_time').attr('value');
var url = "/ctrlmStatistics/historyGraph.do";
alert(url); //此处能显示
$.post( //从这里开始就没反应了
url,
{svrId:1,chartType:bar,dateType:month,beginDate:beginDate,endDate:endDate,width:880 ,height:660},
function(result){
$("#chartPanel").html('<img style="margin:auto" id="chart" src="../images/wait.gif" border="0" usemap="#map" onload="this.style.marginTop=((this.parentElement.offsetHeight-this.offsetHeight)/2);"/>');
$("#chartPanel").html('<img id="chart" src='+result+' border="0" usemap="#map"/>');
//显示滚动条,查询条件展示块display='none'
},
"txt"
);
}
//框架为spring mvc 后台此映射截取不到$.post(……)
@RequestMapping("/ctrlmStatistics/historyGraph.do")
@ResponseBody
public String historyGraph(HttpServletRequest request,HttpServletResponse response)throws Exception {
String chartType = request.getParameter("chartType");
String dateType = request.getParameter("dateType");
String start_time=request.getParameter("beginDate");
String end_time=request.getParameter("endDate");
String svrId=request.getParameter("svrId");
if("day".equals(dateType))
{
}
else//按月查询
{
start_time=start_time.replace("-", "");
end_time=end_time.replace("-", "");
/*start_time=InitMonthDate(start_time);
end_time=InitMonthDate(end_time);*/
}
String templateId = "";//二期如果加上模版id的话,从前台获取id传入
String imgPath = statisticsChartService.getHistoryChart(templateId,
chartType, dateType, start_time, end_time, svrId, request);
return imgPath;