我正在使用以下代码来检查名称是否存在。但是,我无法获取返回值是真还是假以进行进一步验证。如何从这个函数中获取返回值?
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;
}
}
}
);
}