I have gone through all the answers but did not get exact solution of my problem so posting this question.
I am trying to display a confirm box on a specific condition in my controller like this:
if($old_riochannel_upto > $param_valid_from){
echo "<script>if(!confirm(\'Kindly note that a promotional offer is valid between the period DD/MM?/YYYY to DD/MM/YYYY. During this period the prices mentioned in the promotional offer will override the prices mentioned in this RIO\')){ window.location.href = 'index'; } </script>";
}
But this pop is not displaying even if the condition matches. It is displaying if put exit
after closing if
tag.
What I am doing incorrectly?
Just in case anyone face same problem, I am posting the solution which I found myself.
Instead of writing the script tag in echo I just redirected to a different function and there I have called the view where I am displaying this confirm box. Like this:
if($old_riochannel_upto > $param_valid_from){
redirect('Rio/load_modal_update');
}
Then in load_modal_update
function calling the view file which have confirm pop up.
public function load_modal_update(){
$this->load->view('rio/modal_popup_update');
}
I don't know why it did not work in echo statement though.