Codeigniter when i click delete i want pop up notification if if click yes or not

后端 未结 3 878
故里飘歌
故里飘歌 2021-01-24 23:31

Model:

 function delete_exchange($ExchangeRateId) {
    $this -> db -> where(\'ExchangeRateId\', $ExchangeRateId);
    $this -> db ->         


        
相关标签:
3条回答
  • 2021-01-24 23:53

    Do like this in your view..

    <a href="<?PHP site_url('delete/').$ExchangeRateId;?>" onclick="return deletechecked();">delete<?a>
    
        function deletechecked()
        {
            if(confirm("Delete selected messages ?"))
            {
                return true;
            }
            else
            {
                return false;  
            } 
       }
    
    0 讨论(0)
  • 2021-01-24 23:54

    In view Page

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

    Delete Link

    <a href="<?php echo site_url();?>/mycontroller/delete/<?php print($data->auc_id);?>">
       <img  src='images/delete.gif' title="Delete" onClick="return doconfirm();" >
    </a>
    
    0 讨论(0)
  • 2021-01-24 23:56

    you need to do that client side.. in your view... onclick event of a button where you want the conformation use confirm()...

    add this to you button..

    <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;
      }
    }
    
    0 讨论(0)
提交回复
热议问题