Skip to content Skip to sidebar Skip to footer

Always Return True In First Call Returns Correct Value After First Call

I am trying to find wheather exists in data base it always true returns on first attempt var IsEmailExistinInthemo = true; function EmailRegVerify(email) { var url = '/_service

Solution 1:

AJAX is asynchronous. Your return statement runs before the server replies.

You cannot use a return statement; you need to take a callback (like $.ajax does).

Solution 2:

I'm not sure about & in var pars = '&email=' + email; this & is abit strange? And you wrong when use return IsEmailExistinInthemo; like this, function immediately return the true of

var IsEmailExistinInthemo = true;

after setup Ajax Update, not the value that Ajax Update return as expected;

Post a Comment for "Always Return True In First Call Returns Correct Value After First Call"