PHP使用Codeigniter显示弹出成功消息框

时间:2013-10-12 06:47:07

标签: php codeigniter

我尝试在更新记录后显示弹出的成功消息框。这是我在控制器中编写的代码

           $status = $this->order_model->set_bookingByOrderID($id,$data);

           if($status ==1)
           {
            echo '<script>alert("You Have Successfully updated this Record!");</script>';
            redirect('orderManagement/index');
           }
           else{
            $this->session->set_flashdata("message","Record Not Updated!");
            redirect('orderManagement/index');
           }

但脚本不起作用。任何人都可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

我尝试了你的代码,只需要重新定位刷新。请尝试以下代码:

if($status == 1)
           {
               echo '<script>alert("You Have Successfully updated this Record!");</script>';
               redirect('orderManagement/index', 'refresh');
           }
           else{
               $this->session->set_flashdata("message","Record Not Updated!");
               redirect('orderManagement/index', 'refresh');
           }

我希望这会对你有所帮助。