The following is a function that post the values and updation takes place in db according to funcion.But now according to this even if its checked or not checked ,updation doesnt takes place ,ie it returns value 0.
I need to set value as 1 if input is checked and post it too .Is it possible?
<!--HTML part-->
<input type="checkbox" id="gi25" onClick=" print_yes(25,9)" checked="checked">
<!--Jquery part-->
function print_yes(id,uid)
{
var val=$('#gi'+id).val();
$.ajax(
{
type : 'POST',
url : 'custom_ajax.php',
data : 'cmd=greeninfo&id1='+val+'&uid='+uid+'&id2='+id,
dataType : 'json',
success : function(data)
{
}
});
}
You do not currently have a value set for that checkbox
EDIT per OP’s comment: