I have check box and want send value check box (0 or 1) and in entity where clicked check box on some action
<input class="searchType" type="checkbox" name="SharingNotification" id={{ taskExecution.id }}>
<label class="searchtype2label">{{ taskExecution.id }}</label>
</input>
$('.searchType').click(function(event) {
if(this.checked){
$.ajax({
type: "POST",
url: '/app_dev.php/api/customer/customers',
data: {
id: event.target.id,
value: event.target.value
},,
success: function(data) {
alert('it worked');
alert(data);
$('#container').html(data);
},
error: function() {
alert('it broke');
},
complete: function() {
alert('it completed');
}
});
}
});
in request in action
request = {Symfony\Component\HttpFoundation\ParameterBag} [1]
parameters = {array} [2]
id = "1"
value = "on"
I try like this
event.target.id
"1"
event.target.value
"on"
but why "on" I think can be 1 or 0
how to send data like key(id entity) => value(value check box) ?