Problem to delete with clickable and click delete button to jquery?

Hello to everyone
I want to use of clickable jquery and a button delete, for remove rows of database.
The problem is that I do not know how must input checkbox by clickable with click delete button sent to php code?

my jquery code:


$("#tableeven tr")
                    .mouseover(function()                               
                            {
                                $(this).addClass("over");
                            })
                    .mouseout(function()
                            {
                                $(this).removeClass("over");
                            })
                    .click(function()
                            {
                                $(this).toggleClass("click");
                            });
                    $('.delete_i').click(function(){
                        var checkbox = $("input#checkbox").val();
                        var dataString = 'checkbox=' + checkbox;
                        $.ajax
                                        ({
                                            type:"POST",
                                            url: 'http://localhost/diba/index.php/admin/customer_size/delete',
                                            data: dataString,
                                            cache: false,
                                            success: function()
                                            {
                                                $('#delete_i').hide(600,function(){
                                                    $(this).parent().remove();
                                                })
                                            }
                                        });
                                        return false;
                        });

and html code:


<form action="" method="post" accept-charset="utf-8">
<div class="main_indexadmin">
	<div class="top_mainindexadmin">
            <div class="home_i"></div>
	    <div class="print_i"></div>
	    <div class="edit_i"></div>
	    <input type="submit" name="delete" value="" class="delete_i" />
	    <a href="<?php echo base_url();?>index.php/admin/customer_size/add" class="add_i"></a>
        </div>
        
        <div class="line_right"></div>
        <div class="line_left"></div>
	<div id="delet_row">
	<div class="table_show">
	    <div class="tableshow_head">name</div>
	    <div class="tableshow_head">mail</div>
	    <div class="tableshow_head">tel</div>
	    <div class="tableshow_head">data</div>
	    <div class="tableshow_head">order</div>
	    <div class="tableshow_head">code</div>
	
	    <?php
            $query = $this->db->get('customer');
            foreach ($query->result() as $row)
            {
		
		echo '<table id="tableeven" border="0" cellpadding="0" cellspacing="0">';
	    echo '<tr id="delete_i"><td class="none"><input name="checkbox" type="checkbox" id="checkbox" value="'.$row->code.'"></td>';
	    echo '<td class="tableshow_in">'.$row->name.'</td>';
	    echo '<td class="tableshow_in">' .$row->mail. '</td>';
	    echo '<td class="tableshow_in">' .$row->tel. '</td>';
	    echo '<td class="tableshow_in">' .$row->date_added. '</td>';
	    echo '<td class="tableshow_in">' .$row->order. '</td>';
	    echo '<td class="tableshow_in">' .$row->code. '</td></tr>';
	        echo '</table>';
	    }
	    ?>
	</div>
	</div>
	<div class="bottom_mainindexadmin"></div>
</div>
</form>

Thanks for help…

You are using id=“checkbox” for each row. You shouldn’t do that, ids are unique. Same with “delete_i” id of row and id of table. Also checkboxes don’t have values, but they do have names, so use name to identify checkbox. Your code won’t work just because of those errors in html code.

Thanks CyberAlien
You are right. my code does delete rows, but does not delete the row of is selected by clickable jquery. Remove the first row in the database. Please see the jquery code.

hello
i things done, and I was faced with the problem.
To delete a row from the database, click checkbox to select and removed a row selection, we gave up of removed and taking the checkbox but with click on button delete removed row that taking on the checkbox and dont have checkbox.
Please view my js code:


        $("tr")
        .hover(function(){
                                $(this).addClass("over");
                            },function(){
 
                        $(this).removeClass("over");
                        })
        .click(function(){
            $(this).find("td").toggleClass("click");    
            $(this).find("input").attr('checked','checked')
          
         });
          
    $("#delete_i").click(function(){              
        $(".chk").each(function(){             
            if($(this).attr('checked')){
                $(this).parent().parent().fadeOut("slow");
                var checkbox = $(this).val();
                var dataString = 'checkbox=' + checkbox;                
				$.ajax(
				{
					   type: "POST",
					   url: "http://localhost/parsdiba/index.php/admin/customer_size/delete",
					   data: dataString,
					   cache: false,
					
					   success: function()
					   {
					   }
				 });
                       }
                       
                });
            });

and html code:


<form action="" method="post" accept-charset="utf-8">
<div class="main_indexadmin">
	<div class="top_mainindexadmin">
            <div class="home_i"></div>
	    <div class="print_i"></div>
	    <div class="edit_i"></div>
	    <input type="button" title="delet" value="" class="delete_i" id="delete_i"/>
	    <a href="#" class="add_i"></a>
        </div>
        
        <div class="line_right"></div>
        <div class="line_left"></div>
	<div class="table_show">
	    <div class="result"></div>
	    <div class="tableshow_head">name</div>
	    <div class="tableshow_head">mail</div>
	    <div class="tableshow_head">tell</div>
	    <div class="tableshow_head">data</div>
	    <div class="tableshow_head">type</div>
	    <div class="tableshow_head">code</div>
	
	    <?php
            $query = $this->db->get('customer');
            foreach ($query->result() as $row)
            {
		
		echo '<table class="tableeven" border="0" cellpadding="0" cellspacing="0">';
	    echo '<tr><td class="none"><input name="checkbox" type="checkbox" class="chk" value="'.$row->code.'"></td>';
	    echo '<td class="tableshow_in">'.$row->name.'</td>';
	    echo '<td class="tableshow_in">' .$row->mail. '</td>';
	    echo '<td class="tableshow_in">' .$row->tel. '</td>';
	    echo '<td class="tableshow_in">' .$row->date_added. '</td>';
	    echo '<td class="tableshow_in">' .$row->order. '</td>';
	    echo '<td class="tableshow_in">' .$row->code. '</td></tr>';
	        echo '</table>';
	    }
	    ?>
	</div>
	<div class="bottom_mainindexadmin"></div>
</div>
</form>