Welcome Guest, Not a member yet? Register   Sign In
cant delete a record, total n00b here.
#1

[eluser]rotarypot[/eluser]
hola !

i am very very new to ajax/CI, so please be gentle Wink

i am trying to delete a record from my table and also have the nice animation to visually remove the record from the page,of course, i should make the actual record deletion work before moving on to the animation thingie, but im stuck and cant get it to delete records
please help Smile


this makes the "delete" links
Code:
<?= anchor('#', 'borrar', array('class' =>'borrador', 'id'=>$res->img_id));?>

this is my jQuery (in the view file)
Code:
$(document).ready(function() {
    $("a.borrador").click(function (event) {
        event.preventDefault(); // deshabilita el comportamiento de la liga.
  if (confirm('esto borrarĂ¡ la img, de acuerdo? ')){    
        // usuario dijo si a la pregunta.
               var del_id = $(this).attr('id');
               $.post("index.php/moderation/borrar", {item_id : del_id},  function(data){
                      
                       // succcess??
    }); }
});    });

this is my controller (simplified)
Code:
<?php

class Moderation extends Controller {

    function Moderation()
    {
        parent::Controller();

        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->database();    
            
    }
    
    function borrar() {
    
     $this->db->delete('gallery_imgs', array('img_id' => $_POST['item_id']));
    

      
}
    
}


Messages In This Thread
cant delete a record, total n00b here. - by El Forum - 01-07-2010, 02:24 PM
cant delete a record, total n00b here. - by El Forum - 01-07-2010, 03:02 PM
cant delete a record, total n00b here. - by El Forum - 01-07-2010, 03:13 PM
cant delete a record, total n00b here. - by El Forum - 01-07-2010, 03:16 PM
cant delete a record, total n00b here. - by El Forum - 01-07-2010, 03:20 PM
cant delete a record, total n00b here. - by El Forum - 01-07-2010, 03:24 PM
cant delete a record, total n00b here. - by El Forum - 01-07-2010, 03:40 PM
cant delete a record, total n00b here. - by El Forum - 01-07-2010, 03:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB