I am stumped on this issue. I am trying to simply post one variable via ajax. Here is what I have for my javascript/jquery code...
var name = "Bob";
$(".save").click(function(){
$.ajax({
type: "POST",
url: "ajax.php",
data: {fname:name}
}).done(function( msg ) {
alert( "Data: " + msg );
});
});
And here is my ajax.php file:
<?php
$data = $_POST['fname'];
?>
The problem is I always get this error in my php error log...
[15-Aug-2013 11:05:26] PHP Notice: Undefined index: fname in /Applications/MAMP/htdocs/Project/ajax.php on line 2
What am I doing wrong here?