HTML element:
<img align="center" onclick="doc()" src="images/doc.png">
JavaScript function:
function doc (){
$.post("php/file.php", { name: "John", time: "2pm" },).done( function(data) {
alert("Data Loaded: " + data);
});
}
file.php:
$pi=$_POST['name'];
echo ($pi);
I don't know why, but $.post
doesn't send data when I click on the image it doesn't do anything