Welcome Guest, Not a member yet? Register   Sign In
how to delete my entry in ajax way
#1

[eluser]Wondering Coder[/eluser]
Hello to all CI fans,

I'm having a bit of trouble in implementing it using ajax call. What I want is to delete an entry/data in ajax. I know that I can achieve this using jQuery library, but I'm pretty novice in writing codes in javascript.

my controller function
Code:
function delete()
    {
        $item = $this->input->post('item');
        if($message_data != NULL) {
            $this->db->delete('messaging',array('messaging_id'=>$item));
        } else{
            redirect('messaging/view');}
    }

my view
Code:
<div align='right' style='float: right;'><a href='' id='del_comment' class='del_comment'></a></div>
#2

[eluser]Aken[/eluser]
Read into the jQuery post() function, which is a shorthand method of using the jQuery ajax function but defaulting to POST values instead of GET. http://www.jqapi.com/#p=jQuery.post
#3

[eluser]IgnitedCoder[/eluser]
You could also try XAJAX, I used it to call controller methods all the time. See: http://ellislab.com/forums/viewthread/182897/

Pretty straight forward to ajax deletes...

Hope it helps.




Theme © iAndrew 2016 - Forum software by © MyBB