How to test jQuery Ajax with php?
Posted
by vladv
on Stack Overflow
See other posts from Stack Overflow
or by vladv
Published on 2010-05-16T21:33:29Z
Indexed on
2010/05/16
21:40 UTC
Read the original article
Hit count: 210
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?
© Stack Overflow or respective owner