success: function (data) { alert(data); $("#listPeople",navTab.getCurrentPanel()).attr("value",data.listPeople); $("#listTime",data.listTime); }虽然很简单,但是如何传值确实花了自己很多时间,主要对于规则还是很不清楚,当然自己还是在努力看《ajax安全手册》这本书。
$(".sub").click(function(){ var eTime=$("#endTime").attr("value"); var sTime=$("#startTime").attr("value"); $.ajax({ type: "post",contentType:"application/json",async : false,url : "${base}/management/loginMonitor/loginCount/getJson.htm?eTime="+eTime+"& sTime="+sTime,success: function (data) { alert(data); $("#listPeople",data.listTime); } }); });后台代码:
@ResponseBody @RequestMapping("/getJson") public Map<String,Object> getJson(HttpServletRequest request) throws Exception { //显示相应的界面 Map<String,Object> map=loginCountService.getRefreshMap(request); /*Set<Map.Entry<String,Object>> allSet=map.entrySet(); Iterator<Map.Entry<String,Object>> iter=allSet.iterator(); while(iter.hasNext()){ Map.Entry<String,Object> me=iter.next(); System.out.println("test"+me.getKey()+ " "+me.getValue()); }*/ return map; }