Reputation: 121
I saw that there are multiple question on this topic, but I didn't find an answer yet.
JS:
$("#signin-form").submit(function(){
$.post("signin.php", {email: $("#signin_email").val(), password: $("#signin_password").val()}, function(data){
console.log(data);
});
});
PHP (simplified it since it was not working):
<?php
echo "Test";
?>
Result: nothing. And an "POST .../signin.php" error in firebug, that dissappears after less than a second which doesn't give me the chance to read it.
I already tried console.log("anything") too.
Upvotes: 1
Views: 3789
Reputation: 100175
your form seems to be getting submitted, so prevent the default form submission, do:
$("#signin-form").submit(function(evt){
evt.preventDefault();
$.post("signin.php", {email: $("#signin_email").val(), password: $("#signin_password").val()}, function(data){
console.log(data);
});
});
Upvotes: 3