Boolean value sent over Ajax (from client) becomes string on the server side:
var ban_status = null;
ban_status = true;
$.ajax({
type: 'POST',
url: app.baseUrl + "/admin/users/api-ban-user",
data: { "userId": user_id, "banStatus": ban_status },
datatype: "json",
success: function (response) {
if (response.status === true) {
addAlert(response.msg, 'success');
userList();
} else {
addAlert(response.msg, 'error');
}
}
});
In php
$banStatus = $post['banStatus'];
gettype($post['banStatus'])
returns string. How to return the boolean value.
numberorboolorfloat