1

I am using this jquery ajax script to grab values from checkboxes.

$('.cb_delete').click(function(){ 
    //$(document).onclick('.cb_delete' , (function() {      
       var checkboxes_delete = []; 

       $('.cb').each(function(){  
            //if($(this).is(":checked")) { 
            if(this.checked) {              
                 checkboxes_delete.push($(this).val()); 

            }  
       });  
       checkboxes_delete = checkboxes_delete.toString(); 

       $.ajax({  
            url:"",  
            method:"POST",  
            data:{ checkboxes_delete:checkboxes_delete },  
            success:function(data){  
                 $('.echo').html(data);  
                 $('.dynamic-content').load('index.php .dynamic-content > *');
            }  
       });  
    });

When click on the button with class cb_delete, data is send to php and it deletes the values. After the click, the page is dynamically reloaded. When checking again checkboxes and click on delete button, it does not work anymore. I first have to do a hard refresh, then check the checkboxes and then it works again.

How can i solve this problem?

john
  • 1,263
  • 5
  • 18

0 Answers0