Hello,
I need to get the data being passed via Ajax POST. But on the PHP side I can not get past parameters.
My Jquery
onSave: function(data, name) {
pixie.http().post('images/gravar_imagem.php', [{"name": name, "data": data}]).subscribe(function(response) {
console.log(response);
});
},
PHP
<?php
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$name = $request->name;
$data = $request->data;
echo $name;
?>
the following error appears:
error: SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse () at XMLHttpRequest.u
text: "
↵ Notice : Trying to get property 'name' of non-object in C: \ xampp \ htdocs \ pixie \ b> online 17