the situation is, I want to show the modal once the form submission is successful. what i currently do is, after I submit and the form was submitted successfully, I redirect to the same input page. Now the question is, is it possible to set the flash data and pass a jquery script to toggle the modal upon redirection ? here's how i set it in the controller function after the submission was successful.
$js = "<script>$('#mymodal').modal('show');</script>";
$this->session->set_flashdata('js',$js);
then on the view file , I placed a checker at the top so that I will get triggered upon redirection to it.
if($this->session->flashdata('js')){
echo $this->session->flashdata('js');
}
but unfortunately, the modal didn't get triggered to popup at all.. show how ?
You can do it with this way..
From coontroller ... You send a simple flash message like..
$js = "1";
$this->session->set_flashdata('js',$js);
And In View,
<?php
if(isset($this->session->flashdata('js')) && $this->session->flashdata('js')=="1"){
?>
<script>$('#mymodal').modal('show');</script>
<?php } ?>
It will be working fine, Enjoy the code.