0

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?

2
  • either redirect or show alert message but dont try to do both at once Commented Oct 12, 2013 at 7:37
  • Why not just use flashdata for both if you are wanting to redirect? Commented Oct 12, 2013 at 15:19

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.