I'm trying to change content of chatt.php
file on server, using ajax procedure.
$("#btnsend").click(function(){
var a = $("#write").val();
console.log(a); // that's ok
$.ajax({
type: "POST",
url: "ajax.php",
data: a,
dataType: "json",
success: function () {
alert("323");
}
});
});
ajax.php
$a = $_POST["a"];
$b = "chapters/chatt.php");
file_put_contents($b, $a);
There is no alert, chatt.php
is not changed, console is empty.
Any help?