加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 03:20:16 所属栏目:百科 来源:网络整理
导读:@RequestMapping(value="distributor/general") public String allocation_c(Distributor distributor,HttpServletRequest request,HttpServletResponse response,Model model,String codes){ for(codes....){ } PageDistributor page = distributorService.
 
    @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 完美解决问题 页面跳转

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读