I am having issues on a jquery function to update the mysql table with a checkbox. No matter what if I check the box or not this function only updates the table with a 0.
Here is my jquery function:
$(function(){
$(document).on('click','.editEntry',function(e){
//process here you can get id using
var entryId = $(this).data('id');
var activeEntry = $(this).is(':checked') ? 1 : 0;
$("#id").val( entryId );
$("#active").val( activeEntry );
$('#update-entry').click( function (event) {
$.ajax({
"dataType": 'json',
"type": "POST",
"url": "includes/process-entry.php",
"data":{
"id" : $('#id').val(),
"active" : $('#active').val()
},
"success": function() {
$('#updated').show();
window.setTimeout(function(){location.reload()},400);
}
});
});
});
});
<input name="id" type="text" disabled="disabled" id="id" size="4" value ='1'>
<input type="checkbox" name="active" id="active">
Can anyone let me know what is incorrect on why it is not inserting the '1' into the database when it is checked?
Thank you in advance. Let me know if there is more information