Вместо этого следует использовать метод GET.
$email = 'xxx@gmail.com';
$password = 'password';
<script>
var user = <?php $email; ?>;
var pass = <?php $password; ?>;
$.ajax({
url: 'http://www.example.com/login',
type: 'GET', //send it through get method
data: {
email: user,
password: pass
},
success: function(response) {
//Do Something
},
error: function(xhr) {
//Do Something to handle error
}
});
</script>
Затем проверьте на странице входа в систему параметры электронной почты и пароля, заданные методами GET или POST.
<?php
if (isset($_GET['email']) && isset($_GET['password']) || isset($_POST['email']) && isset($_POST['password'])){
// check your database and take actions.
}else{
// do nothing and show the post from again.
}
?>