Yeah! I've found the solution!
There is a request code example:
$.ajax({
url: 'https://food-tracker.ru/foods',
type: 'POST',
dataType: 'JSON',
data: {term: 'rjk'},
success: function (data) {console.log(data);}
});
And there was server code:
protected function returnJSON($data) {
header('text/html; charset=utf-8');
echo json_encode($data);
die(0);
}
The solution is to change line header('text/html; charset=utf-8'); to header('Content-type: application/json; charset=utf-8');
So, right working code is:
protected function returnJSON($data) {
header('Content-type: application/json; charset=utf-8');
echo json_encode($data);
die(0);
}
Thanks for your attention!
P.S. But one question i still have: why was it working fine before, and brokes when just hosting changed?