Hi,
Can any give me a clue why this isn't working? The function returns undefined. It alerts a boolean values but still return undefined?!
Thanks
function IsUniqueEmail() {
var email = $("#<%=EmailAddress.ClientID%>").val();
if (email.length > 0) {
$.ajax({
url: 'handlers/validator.ashx',
dataType: 'json',
data: { "n": "email", "v": email },
async: false,
success: function(data) {
alert(eval(data.success));
return eval(data.success);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus, errorThrown);
return true;
}
});
}
}
$(document).ready(function() {
var execScript = $(".buttonStep1").attr("href").replace("javascript:", "");
$(".buttonStep1").attr("href", "#").click(function() {
// Add before click logic here
var IsOk = IsUniqueEmail();
if (IsOk) {
$("#EmailAddressInUseMessage").hide();
eval(execScript);
}
else {
$("#EmailAddressInUseMessage").show();
}
});
});
this is the response of the ajax call
{ "success": false, "error" : "ERROR_EMAILINUSE" }