I’ve a kind and one of many fields is an electronic mail with id electronic mail and after the person
inputs their electronic mail and clicks exterior the sphere, I want to get the worth of the e-mail after which use ajax to cross that worth to a different php file that may run a wordpress operate referred to as email_exists() after which cross that outcome again to ajax. Proper now I simply wish to console log the outcome worth after which later I’ll add additinal jquery to alert the person within the kind.
I’ve my present code beneath and it isn’t exhibiting something within the console even when I put an electronic mail that does exist on my wordpress web site and I can not work out why. Any assist can be nice, thanks!
staff.php
<script>
$(operate() {
$("#electronic mail").blur(operate () {
var electronic mail = $(this).val();
url: 'validation.php',
sort: ' POST',
information: {
electronic mail: electronic mail
},
success: operate(response) {
console.log("response");
},
error: operate(response) {
console.log("response");
}
});
});
<script>
validation.php
<?php
$response = email_exists($_POST['email']);
echo $response;
?>