Laravel重定向,a链接跳转,控制器跳转示例
作者:SHUIPING_YANG 时间:2024-04-28 09:45:02
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');
来源:https://blog.csdn.net/zhezhebie/article/details/78328091
标签:Laravel,重定向,a链接,控制器,跳转
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
常用的数据库访问方式是什么?
2009-11-01 15:08:00
centos7环境下二进制安装包安装 mysql5.6的方法详解
2024-01-26 23:37:33
Mysql 服务 1067 错误 的解决方法:修改mysql可执行文件路径
2024-01-27 04:06:09
![](https://img.aspxhome.com/file/2023/0/128380_0s.jpg)
Python使用selenium + headless chrome获取网页内容的方法示例
2023-05-02 05:27:37
Django中的Signal代码详解
2023-02-23 01:20:11
![](https://img.aspxhome.com/file/2023/0/124730_0s.png)
sql 常用技巧整理
2011-11-03 17:10:14
JavaScript 模拟类机制及私有变量的方法及思路
2024-05-03 15:04:55
oracle 服务启动,关闭脚本(windows系统下)
2009-07-26 08:57:00
Python-OpenCV深度学习入门示例详解
2022-07-24 02:44:24
![](https://img.aspxhome.com/file/2023/3/110403_0s.jpg)
PHP实现克鲁斯卡尔算法实例解析
2023-09-08 19:35:57
支付宝lab logo设计创意发想
2009-11-12 12:44:00
![](https://img.aspxhome.com/file/UploadPic/200911/12/blog1-38s.jpg)
sqlserver巧用row_number和partition by分组取top数据
2024-01-28 12:33:39
chatGPT本地部署、运行和接口调用的详细步骤
2023-08-31 03:46:31
![](https://img.aspxhome.com/file/2023/9/104959_0s.jpg)
小议javascript设计模式
2009-10-09 13:31:00
Python科学计算环境推荐——Anaconda
2022-12-17 15:07:30
![](https://img.aspxhome.com/file/2023/0/84990_0s.jpg)
python3的url编码和解码,自定义gbk、utf-8的例子
2022-08-02 10:07:39
Python Flask搭建yolov3目标检测系统详解流程
2023-07-07 12:40:05
![](https://img.aspxhome.com/file/2023/3/95203_0s.gif)
巧用Dreamweaver制作复杂图像
2010-09-02 12:34:00
![](https://img.aspxhome.com/file/UploadPic/20072/200723113139567s.jpg)
JS实现水平遍历和嵌套递归操作示例
2024-04-22 12:48:01
使用Python导出Excel图表以及导出为图片的方法
2021-02-28 09:59:21
![](https://img.aspxhome.com/file/2023/1/80601_0s.png)