简体   繁体   English

如何在Laravel中重定向到当前页面

[英]How do I redirect to current page in laravel

I am working with laravel 3. I have an action button which will open a popup modal. 我正在使用laravel3。我有一个操作按钮,它将打开一个弹出模式。

I have a list of devices. 我有设备清单。 for first page, the popup modal was there. 对于第一页,弹出模式在那里。 But for second page, the popup modal not coming out but it redirect back to the first page. 但是对于第二页,弹出模式不会出现,但会重定向回第一页。

index.blade.php code: index.blade.php代码:

{{ HTML::link("devices#openProfile", "Impose Profile", array("id"=>$deviceid,"class"=>"btnSkyBlue","onclick"=>"openImposeProfile($device->id)")) }} {{HTML :: link(“ devices#openProfile”,“ Impose Profile”,array(“ id” => $ deviceid,“ class” =>“ btnSkyBlue”,“ onclick” =>“ openImposeProfile($ device-> id )“))}}

JS: JS:

function openImposeProfile(id) { 函数openImposeProfile(id){
document.getElementById("openProfile").style.display="block"; document.getElementById(“ openProfile”)。style.display =“ block”;
var intentedId = document.getElementById("devId_profile"); var intentedId = document.getElementById(“ devId_profile”);
intentedId.value = id; intentedId.value = id;
console.log("dev id: "+id+" | intended: "+intentedId.value); console.log(“ dev id:” + id +“ |意图:” + intentedId.value);
} }

This is how you would do it in L4 这就是您在L4中的做法

<a href="{{ URL::to('devices') }}#openProfile" id="{{ $deviceid }}" class="btnSkyBlue" onclick="openImposeProfile('{{ $device->id }}')">Impose Profile</a>

URL::to might be different in L3 URL :: to在L3中可能有所不同

Tip: you should learn jQuery :) it will make your life easier 提示:您应该学习jQuery :)它将使您的生活更轻松

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用JavaScript重定向到当前页面? - How do I redirect to the current page using JavaScript? 如何通过打开新窗口执行OAuth请求,而不是从当前页面重定向用户? - How can I do OAuth request by open new window, instead of redirect user from current page? 当我单击注销按钮时,会打开确认警报。 当我取消时,它将重定向登录页面,但我想重定向当前页面。 我该怎么做? - When i click in logout button open a confirm alert. When i cancel it will redirect login page but i want to redirect current page. How i can do it? 如何重定向到同一页面 - How do I redirect to same page 如何在 React js 中将登录重定向到当前页面? - How can I redirect login to current page in react js? 如何将html从当前页面附加到另一个页面? - How do I append html to another page from the current page? 如何使用javascript重定向到当前页面 - how to redirect to current page using javascript 如果未处于登录状态并且登录后重定向到原始页面,如何重定向到登录页面? - How do I redirect to login page if not in logged in state and after login redirect to the original page? 使用Cordova进行HTTP重定向,如何重新加载浏览器重定向到的页面? - http redirect with cordova, how do I reload the page redirected to by the browser? 使用JavaScript下载后如何重定向到新页面? - How do I redirect to a new page after a download using Javascript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM