I have a program which should send a JSON from the Console to a PHP
var nice = any_jsonfile;
console.log(JSON.stringify(nice)); // here it shows desired contents
var nice2 = JSON.stringify(nice);
$.ajax({
type: "POST",
url: "/postgetter.php",
data: nice2,
dataType: "text"
});
The Postgetter contains
<?php
$data = $_POST;
$data_string=implode ( $data );
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = $data_string;
echo "<pre>";
print_r($data);
echo "</pre>";
fwrite($myfile, $txt);
fclose($myfile);
?>
I see the ajax is sending it but it doesn't get any data in to the postgetter.php
What I am doing wrong here?