看,这一部分:
$.ajax({
url: url,
data: args,
dataType: "json",//返回类型
type: "POST",//请求方式
success: function (data) {
var tempb = $(".search_body");
tempb.html("");
$(".search_currentPage").html(${requestScope.allResultPages});
$(".search_pages").html(${requestScope.curResultPage});
//请求成功时处理
showDatas(data, tempb);
},
代码是没有问题的。这是前端发送ajax请求。然后,请求,我在后端赋值:我把页码都妨碍map里面了,可是在前端,上面的代码无法获得更新后的值,还是原来的。请问,如何解决这种问题?
或者有什么方法能够解决从后端传值到前端,注意这里是ajax
@ResponseBody
@RequestMapping("searchByCounty")
public List searchByCounty(@RequestParam("search_name") String name, Map map) {
List list = productionDao.getAllProductionByCountry(name);
int allResultPages = (int) ((Page) list).getTotal();
int curResultPage = ((Page) list).getPageNum();
map.put("allResultPages", allResultPages);
map.put("curResultPage", curResultPage);
return list;
}