1
JS file:
var jsonsave = [];
var dado = new Object();
dado.nome= "João";
dado.cpf = "000";
dado.teste = "teste";
var jason = JSON.stringify(dado);
jsonsave.push(jason);
$.ajax({
type: "POST",
dataType: "JSON",
url: "http://localhost/moodle/my/index.php",
data: "data="+jsonsave+"&ENVIO_RESPOSTAS=true",
success: function(data){
console.log('foi');
},
error: function(data)
{
console.log(data);
}
});
Php file:
$arquivo = $_POST['data'];
$value= json_decode($arquivo, TRUE);
I call the php page by ajax, but I can’t get the json values, come null, anyone have any idea?
I saw now that you had already posted this question a little bit. And posted again. It is not recommended to do this. Your question will be answered as soon as someone with knowledge of the subject and availability of time visualizes it. Posting the same question again will only cause it to be deleted.
– mau humor
ah I excluded that, because I had already posted, I thought I had not gone, I myself excluded that, sorry
– rods
Okay, in that case, disregard what I said.
– mau humor