Answer the question
In order to leave comments, you need to log in
How to pass boolean parameter in AJAX?
How to pass a boolean type parameter to the server, when passing the parameter, a string arrives at the server. the variable status - type boolean (checked through typeof)
is a trace. request
$.ajax({
type: 'POST',
url: '/TODOList/'+status,
data: params,
success: function (req, res) {
if(status == true){
$target.attr('checked', true);
}else {
$target.removeAttr('checked');
}
console.log(status);
//location.reload();
},
error: function (errоr) {
console.log(error);
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question