I am trying to send data that i got from a jquery call and now i want to save it to a file on the server with php.
function getSVG(){
svghead = svghead + $('#test').html();
$.ajax({
type:"POST",
data: svghead,
url: "xyz.php",
success:function(data){
.....
}
});
}
and in php my code is:
<?php
header('Content-Type: text/html; charset=utf-8');
$data = $_POST['data'];
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
fwrite($myfile, $data);
fclose($myfile);
?>
but the created file never contains any value. it s just empty. as far as i tested, i guess it is just a syntax mistake but where or what is wrong? thx for any help