I know that sending json from PHP to JS is totally viable, but is it possible to send my data via json ajax to PHP?
I know that sending json from PHP to JS is totally viable, but is it possible to send my data via json ajax to PHP?
Yes, it is possible to send data via json ajax to PHP.
The intent of the JSON format is to be universal. Although the JSON format is JavaScript syntax, it is read by other languages and is now the default for sending data.
var json = JSON.stringify(dados);
and in PHP:
$dados = json_decode($json);
$json = json_encode($dados);
and in JavaScript:
var dados = JSON.parse(json);