According to the checkbox information I received from the frontend, I will record to the database in the backend. I am stuck in the part where I wrote not working as expected, please help.
Frontend;
$.ajax({
url: '{{ route('diffacts.manage.confirm.process ') }}?a=e&id=' + data.id,
method: 'GET',
data: {
date_start: $('#date_start').val(),
duration: $('#duration').val(),
operation_type_id: $('#diffact_type_id').val(),
description: $('#description').val(),
// the if / else not working as expected
if ($('#FaturaDurum').is(":checked")) {
document.getElementById('FaturaDurum').value = "1"
} else {
document.getElementById('FaturaDurum').value = "0"
}
FaturaDurum: $('#FaturaDurum').val()
}
})
Backend;
if($request->input('FaturaDurum') == "1") {
$faturadurum = 'Faturalandirilmamis';
}
else {
$faturadurum = 'Faturalandirilmis';
}
Santiago Trujillo
I think it's better to write the code like this:
someValue : $('#FaturaDurum').is(":checked")