Codeigniter当我点击删除时我想要弹出通知,如果点击是或否

Wel*_*ays 1 javascript php codeigniter

这是模型

 function delete_exchange($ExchangeRateId) {
    $this -> db -> where('ExchangeRateId', $ExchangeRateId);
    $this -> db -> delete('exchange_rate');
}
Run Code Online (Sandbox Code Playgroud)

这是控制器

function delete($ExchangeRateId) {
        $user_type = $this -> session -> userdata('user_type');
        if ($user_type != "admin") {
            redirect(base_url() . 'user_admin/login');
        }
        $this -> all -> delete_exchange($ExchangeRateId);
        redirect(base_url() . 'exchange/index');
    }
Run Code Online (Sandbox Code Playgroud)

删除按钮是清除的,听到我想要弹出是或然后必须运行我的意思删除通知

thansk提前...

小智 9

在视图页面

<script>
function doconfirm()
{
    job=confirm("Are you sure to delete permanently?");
    if(job!=true)
    {
        return false;
    }
}
</script>
Run Code Online (Sandbox Code Playgroud)

删除链接

<a href="<?php echo site_url();?>/mycontroller/delete/<?php print($data->auc_id);?>">
   <img  src='images/delete.gif' title="Delete" onClick="return doconfirm();" >
</a>
Run Code Online (Sandbox Code Playgroud)