2013年9月6日星期五

spring mvc action not receive ajax request reception problems ! ! Online waiting ......

Reception submitted using js ajax request the following code
function getImgPathByCond ()
{
$ ("# chartPanel"). html (' ');

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); / / here to show
$. post (/ / no response from here
url,
{svrId: 1, chartType: bar, dateType: month, beginDate: beginDate, endDate: endDate, width: 880, height: 660} ,
function (result) {
$ ("# chartPanel"). html (' ');
$ ("# chartPanel"). html (' ');
/ / display scroll bars , query display block display = 'none' ;
},
"txt"
);
}

/ / Framework spring mvc background interception less than this map $. 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 / / month query
{
start_time = start_time.replace ("-", "");
end_time = end_time.replace ("-", "");
/ * start_time = InitMonthDate (start_time);
end_time = InitMonthDate (end_time); * /
}
String templateId = "" ;/ / two if coupled with template id , then passed from the front desk to obtain id
String imgPath = statisticsChartService.getHistoryChart (templateId,
chartType, dateType, start_time, end_time, svrId, request);

return imgPath;
}
first posting , do not know what effect , looking forward to ......
------ Solution ------------------- -------------------------
var url = "/ ctrlmStatistics / historyGraph.do ";
phrase is not used as an absolute path to the
------ Solution --------------------------- -----------------

/ / framework spring mvc background interception less than this map $. post ( ...... )
@ RequestMapping ("/ ctrlmStatistics / historyGraph.do")
@ ResponseBody
public String historyGraph (HttpServletRequest request, HttpServletResponse response) throws Exception {}

parameter method you wrote

------ For reference only ---------------------------------- -----
@ RequestMapping ("/ ctrlmStatistics / historyGraph.do")
remove the back . do you filter in the web.xml Is not that *. do?
------ For reference only ---------------- -----------------------
var url = "historyGraph.do? svrId =" + svrId + "& chartType = "+ chartType +" & dateType = "+ dateType +" & beginDate = "+ beginDate +" & endDate = "+ endDate;
$. post (
url,
{width: fixWidth () - 25, height: fixHeight () - 50},
function (data) {
$ ("# chartPanel"). css ('height', fixHeight ());
$ ("# chartPanel"). css ('width', fixWidth ());
/ / $ ("# chartPanel"). html (' ');
$ ("# chartPanel"). html (' ');
/ / display scroll bars , query display block display = 'none'
$ ('# chartContent'). layout ('collapse', 'north') ;/ / Click query collapse
}
);


@ RequestMapping ("/ ctrlmStatistics / historyGraph.do")
@ ResponseBody
public String historyGraph (HttpServletRequest request,
HttpServletResponse response) throws Exception {


project where this is used , it is possible to intercept , really strange , try upstairs , remove / or not.
------ For reference only -------------------------------------- -
solved thanks for reply , and give a reply to the first one . .

没有评论:

发表评论