user1805430
user1805430

Reputation: 107

PHP display pop-up success message box using Codeigniter

I am try to display a pop-up success message box after a record is updated. Here is the codes I wrote in controller

           $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');
           }

but the script does not work. Can anyone help me to solve this?

Upvotes: 0

Views: 44033

Answers (1)

yhAm
yhAm

Reputation: 473

I tried your code and just need to put a refresh on redirect. Please try this code:

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');
           }

I hope this will help you.

Upvotes: 2

Related Questions