array(2) { ["id"]=> array(2) { [0]=> string(1) "2" [1]=> string(1) "2" } ["presenca"]=> array(2) { [0]=> string(5) "false" [1]=> string(4) "true" }
$(document).ready(function(){
$('#btn_update').click(function(){
var id = [];
var presenca = [];
$(':checkbox').each(function(i){
presenca[i] = $('#permissao').val();
id[i] = $('#id').val();
if(presenca[i] == this.checked){
this.checked = true;
presenca[i] = this.checked;
}else{
this.checked = false;
presenca[i] =this.checked;
}
});
$.ajax({
url:'<?php echo WEBROOT; ?>/sistema/modulos/processa-permissao.php',
method:'POST',
data:{id:id, presenca:presenca},
success:function()
{
alert('update ok');
}
});
});
The intention is whether or not to mark ajax by inserting the update in looping.
What am I missing?