ajax向controller发送请求 页面不跳转到另一个页面

 
    @RequestMapping(value="distributor/general")
    public String allocation_c(Distributor distributor, HttpServletRequest request, HttpServletResponse response, Model model, String codes){


        for(codes....){

           
        }

        Page<Distributor> page = distributorService.findPageGeneral(new Page<Distributor>(request,response),distributor);
        model.addAttribute("page",page);

       
        return "xxx/distributorGeneralList";
    }
$.ajax({
                url:'/xxx/distributor/general',
                type: "post",
                data: codes,
                success: function (result) {
                    //由于ajax发送的url到控制层不会进行页面的跳转,因为当请求成功以后,请求依然会回success,所以可以在此再写一遍url进行跳转
                    window.location.href="/xxx/distributor/general";
                }
            });

window.location.href 完美解决问题 页面跳转
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页