I am using the following code to check if a name exists. However, I cannot get the return value whether true or false for further validation. How can I get the return value from this function?
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;
}
}
}
);
}