first of all, i already trying maybe all of the possible answer in this site but nothing is working for me.
i want to show pop up windows confirmation before delete my data. i use this
<a href="<?php echo site_url('admin/barang/delete/'.$val->idBarang);?>" onclick="return confirm('Are you sure ?')">Delete</a>
Maybe you need my controller
public function delete($id = 0) {
$id OR redirect(site_url('admin/barang'));
$this->barang_m->delete($id);
redirect(site_url('admin/barang'));
}
My model barang_m
public function __construct(){
parent::__construct();
parent::set_table('barang','idBarang');
}
public function delete($id = 0) {
if($data = parent::get($id)) {
parent::delete($id);
return true;
}
return false;
}
but when i click cancel it still delete the data even when i clicked 'x' to close the confirmation window. i'm so frustated please help me. Or maybe you can tell me why this problem occurs ?
**i alrady tried this possible answer
Codeigniter when i click delete i want pop up notification if if click yes or not
jQuery delete confirmation box
Confirm box in CodeIgniter anchor link to delete record
and many more