欢迎来到代码驿站!

PHP代码

当前位置:首页 > 软件编程 > PHP代码

Laravel重定向,a链接跳转,控制器跳转示例

时间:2021-03-31 09:14:47|栏目:PHP代码|点击:

Laravel重定向分类如下:

1、a链接跳转:

<a class="btn btn-success" href="{{url('admin/organization/createAuthCodeView', ['id' => $list['id']])}}" rel="external nofollow" >生成注册码</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')}}" rel="external nofollow" 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('/admin/organization/listOrganization');

上一篇:php调用mysql存储过程

栏    目:PHP代码

下一篇:Content-Disposition使用方法和注意事项

本文标题:Laravel重定向,a链接跳转,控制器跳转示例

本文地址:http://www.codeinn.net/misctech/91885.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有