Reputation: 107
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
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