0
我正在使用下面的代码来检查名称是否存在。 但是,我无法获得返回值是否为真,以进一步验证。我怎样才能从这个函数获得返回值?从嵌套的jquery函数返回一个值
function check_availability() //check auction name if exists
{
var new_Auction =$('#txtAuction').val();
$.post('checkAuction.php',{txtAuc:$('#txtAuction').val()},
function(result){
if(new_Auction.length==0)
{
$('#message').html('');
}
else
{
if(result==1)
{
$('#message').html(new_Auction + ' is Available').css('color','#0C3');
$('input[id=btnCreate]').removeAttr('Disabled');
//$('h4.alert_success').css("display","block");
//$('h4.alert_success').html(new_Auction + ' is Available');
//$('h4.alert_success').fadeOut(5000);
return true;
}
else
{
$('#message').html(new_Auction + ' is not Available').css('color','#F00');
$('input[id=btnCreate]').attr('Disabled','Disabled');
//$('h4.alert_error').css("display","block");
//$('h4.alert_error').html(new_Auction + ' is not available');
return false;
}
}
}
);
}
那么有什么办法可以得到验证与其他jQuery返回功能一起吗? – user1657720