Laravel中的几种跳转方式

1、a链接跳转:

<a class="btn btn-success" href="{{url('admin/organization/createAuthCodeView', ['id' => $list['id']])}}">生成注册码</a>
  •  

2、form表单提交跳转:

<form class="form-inline" method="get" action="{{ url('admin/organization/listOrganization') }}">
  <div class="form-group" style="margin-left: 20px">
    <input type="hidden" name="customer_type" value="1">
    <label for="perPage">每页显示数:</label>
    <select class="form-control" id="perPage" name="perPage">
      @foreach ( [10,20,30,50] as $e)
      <option value="{{$e}}" {{ $e==request('perPage') ? 'selected' : '' }} >{{$e}}</option>
      @endforeach
    </select>
  </div>
  <div class="form-group" style="margin-left: 20px">
    <label for="search">模糊搜索:</label>
    <input type="text" name="search" style="width: 400px" class="form-control" id="search" placeholder="请输入用户名或者邮箱或者电话" value="{{request('search')}}">
  </div>
  <button type="submit" class="btn btn-primary" style="margin-left: 20px">开始搜索</button>
  <a href="{{url('admin/organization/createOrganization')}}" class="pull-right">
    <button class="btn btn-primary">新增机构</button>
  </a>
</form>

3、ajax提交跳转:

<script type="text/javascript">
  $(function(){
    $.ajaxSetup({
        headers: { 'X-CSRF-TOKEN' : '{{ csrf_token() }}' }
    });
   $("#generate").click(function(){
    $.ajax({
           url:"/admin/organization/generateAuthCode", //你的路由地址
           type:"post",
           data:{"auth_num":$('#auth_num').val(),"organization_name":$('#organization_name').val()},
           timeout:30000,
           success:function(data){
             $("#auth_codes").val(data);
           },
           error:function(){
            console.log(data);
          }
        });
  });
 })
</script>

4、控制器方法里面跳转:

return redirect("errors/403?from={$url}");
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值