6
I know it is fully feasible to send PHP json to JS, but it is possible to send my data via ajax in json format to PHP?
6
I know it is fully feasible to send PHP json to JS, but it is possible to send my data via ajax in json format to PHP?
9
Yes, it is possible to send data via ajax in json format to PHP.
The intention of the JSON format is to be universal. Although the JSON format is Javascript syntax, it is read by other languages and is today the default to send 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);
Thank you, you helped me a lot.
But how to send json to php?
@Neo take a look here: http://answall.com/a/20920/129
Browser other questions tagged php javascript ajax json
You are not signed in. Login or sign up in order to post.
Yes it is possible.
– rray