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

2024-01-19

Model:

 function delete_exchange($ExchangeRateId) {
    $this -> db -> where('ExchangeRateId', $ExchangeRateId);
    $this -> db -> delete('exchange_rate');
}

控制器:

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

删除按钮很清晰,在这里我想要一个通知,例如弹出“是”或然后必须运行我的意思是删除的操作


在视图页面中

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

删除链接

<a href="<?php echo site_url();?>/mycontroller/delete/<?php print($data->auc_id);?>">
   <img  src='images/delete.gif' title="Delete" onClick="return doconfirm();" >
</a>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Codeigniter 当我单击“删除”时,如果单击“是”或“否”,我想要弹出通知 的相关文章

随机推荐