using variables within a jquery function....
i declared 2 variables which i want to use depending on a conditional statement inside a jquery function
unfortunately they don't seem to be working. do they need to be globals?
- var errors = 0;
var errormsg = '';
$.post(
"ajax-check-email.php",
{ email_address: document.getElementById('email').value },
function (data) {
if (data == 'taken')
{
errors = 1;
errormsg = 'This email address is already registered';
}
});
i know for a fact that the code works, when i add an alert inside the conditional statement it pops up fine, but these variables don't seem to get their values applied.