我在jQuery的经验是有限的,我周围中搜索的答案,但似乎无法找到它。jQuery的检查返回undefined
这个函数返回一个或真或假基于一个get。现在我的问题是,如果我得到我的数据,函数'可用性'不会返回一个错误,也不会返回true。
这是代码。
function Availability(){
var email = jQuery('#emailRegister').val();
jQuery.get("test.php", {email: email})
.done(function(data) {
if(data == 'true'){
jQuery(".warningEmailDuplicate").hide();
return true;
}else if(data == 'false'){
jQuery(".warningEmailDuplicate").show();
return false;
}
});
}
http://stackoverflow.com/questions/5316697/jquery-return-data-after-ajax-call-success –