How to test jQuery Ajax with php?
- by vladv
I tried to just send some information to a php file using Jquery Ajax. I wanted to send some info to the php file every time a click is made.
<script>
$(document).ready(function() {
$('#checkbox').click(function() {
$.ajax({type : "POST",
url : "test.php",
data : "ffs=somedata&ffs2=somedata2",
succes : function() {
alert("something");
}
});
});
});
</script>
<body>
<input type = "checkbox" name = "checkbox" id = "checkbox">
</body>
The php file looks like this:
<?php
echo $_POST['ffs'];
?>
Now, I see the POST going, (using firebug). I get no errors, but nothing happens in the php file. Also success is never reached, so no alert is triggered. What should I do in the php file so that I can trigger success and also see the sent info?