1

模型:

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

删除按钮很清楚,在这里我想要一个通知,比如弹出是或者必须运行我的意思是删除的操作

4

3 回答 3

9

在视图页面

<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>
于 2013-06-03T07:34:00.660 回答
1

在你看来这样做..

<a href="<?PHP site_url('delete/').$ExchangeRateId;?>" onclick="return deletechecked();">delete<?a>

    function deletechecked()
    {
        if(confirm("Delete selected messages ?"))
        {
            return true;
        }
        else
        {
            return false;  
        } 
   }
于 2013-06-03T07:33:18.987 回答
0

你需要做那个客户端..在你看来......你想要构造使用的按钮的onclick事件confirm()......

将此添加到您的按钮..

<button onclick="confirmation()" />

function confirmation()
{
   var r=confirm("are you sure to delete?")
   if (r==true)
  {
    alert("pressed OK!")
    // call the controller
  }
  else
  {
   alert("pressed Cancel!");
   return false;
  }
}
于 2013-06-03T07:34:16.397 回答