I'm using jQuery .post() [see: [
api.jquery.com ]] to send data to a PHP file for processing and can't get it to work. It's likely a simple syntax error, but I don't see it. Here's my code:
function do_php(){
var $data = "test";
$.post("/file.php", {data:$data});
}
window.onload = do_php;
My PHP file reads the data via:
$my_var = $_POST['data'];
I had this working at one point, but something got changed somewhere along the line & I can't get back.
If it helps, I don't even get info when I add the 'success' callback function:
$.post("/file.php", {data:$data}, function(data){alert(data);});