dimanche 3 mai 2015

checkbox with ajax in codeignoter

i want to make a checkbox in every data on table, and when i click the checkbox the database change with ajax

My View Code

            foreach($dataProperty as $property)
            {
                echo form_checkbox('prop[]','$property->property_id','TRUE'). "On/Off";
            }

My Ajax

        $("#prop[]").clicked(function(){
            var prop_id = $("#prop[]").val();
            $.ajax({
                type    : "POST",
                url     : "<?php echo base_url('property/update_property'); ?>",
                data    : "prop_id=" + prop_id
            });
        });




Aucun commentaire:

Enregistrer un commentaire