I have a problem with redirection in embed view.
I'm, working on a project, where security is very important. I use codeigniter and bootstrap. I have main view, which includes navbar and some other html. In that main view i have <div id="change">
which i am changing via button group. With those buttons I am calling functions in controller with jQuery which (functions in controller) contains $this->load->view('pages/something', $data);
When i press on one of those buttons <div id="change">
is changed and in it, a view is shown and link is not changed, so main view remains as it is.
<script>
var vari = "<?php echo $data['vari']; ?>";
$(function() {
$("#btn1").click(function() {
$("#change").load("Controller/function1/"+vari)
})
$("#btn2").click(function() {
$("#change").load("Controller/function2/"+vari)
})
$("#btn3").click(function() {
$("#change").load("Controller/function3/"+vari)
})
$("#btn4").click(function() {
$("#change").load("Controller/function4/"+vari)
})
$("#btn5").click(function() {
$("#change").load("Controller/function5/"+vari)
})
})
When i do things in one of those embed views, sometimes i want to use redirect('/Controller', 'refresh');
. Problem is, that when i use it, just embed view is changed - redirected, but main view with navbar and button group is still there.
How can i achieve, that when i call redirect()
in "embed controller function", main view is changed, not only <div id="change">
. Is this possible? If not with my method - what could be alternative solution, how can you redirect whole page from "embed controller function" (sorry i dont know how to name this =D).
I will appreciate any help. Thanks!
If you want to redirect the user to another page you can use the following
var url = 'your/next/page';
$(location).attr('href',url);
without using jQuery you can also do
window.location.href = url;
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다