I have setup a jQuery keyup delay function to check the email typed into an input field.
It works fine after testing with an alert('Key pressed!');
But I want it to say, for example, 'Yes this email is associated with a user' OR 'Sorry, this email is not in our database' without submitting any page requests.
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();
$('input').keyup(function() {
delay(function(){
// check email exists and output result
// Can I use PHP here?
// Can ajax/json help?
}, 500 );
});
I tried to check with php but this is rendered before the jQuery of course which is where I'm storing my email var.
After a few google searches it sounds like this may not be possible. Can anyone confirm or offer a solution?
Thanks
<?php if ( email_exists($email) ) { . . . } ?>which is wordpress specific. So I suppose you could generalise my question as, can I use jquery/json/ajax withif ( email_exists($email). – Graeme Oct 17 '12 at 12:52