check box toggle using jquery and laravel
view page in laravel will be as like below
1 2 3 4 5 6 7 8 |
<?php for($i=0;$i<3;$i++) { $chk_status=getstat($i); ?> <input type="checkbox" class="status_update_class" name="status_update" id="status_update" emp_id="<?php echo $i; ?>"> |
Dynamicaly listed records better we have to use class name in the ajax call
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$(".status_update_class").unbind('click').bind('click', function () { var emp_id = $(this).attr('emp_id'); if ($(this).is(":checked")) { var ct_status = '1'; } else { ct_status = '0'; } }); |