在jQuery Ajax中返回true

I am using ajax inside jquery to check whether the value exist in database or not. We can use normal select query(php) for this, but i have to make alert popup if the value exist. That's why i decide this way. I almost done, but problem is due to return false in jquery it does not allow to next line eventhough name does not exist in database. How can i give return true in that particular place?

$.ajax({
    type:"post",
    url:"actionn.php",
    data:"name="+name,
    success:function(data){
        alert(data);        
        //if data does not exist means it should get out of ajax function            
    }
});
return false; //if data exists

if(name=="") //data does not exist means it should come here
{
    alert("Please enter your Name");
    return false;
}

Just put this

return false; //if data exists

within this

success:function(data){
   alert(data);        
   //if data does not exist means it should get out of ajax function     
   return false; //if data exists - //LIKE THIS
}

You could use a if condition inside the success function like:

success:function(data) { 
    if(data) { 
         alert(data); 
    }  
    else { 
         alert("Please enter your Name"); 
         return; 
     }     
 }

See the documentation of $.ajax

As t.niese pointed out return true (or false) inside success is not doing what you probably expect it will do. (See also first comment under your question).

Probably the most straight-forward way to achieve your goal is to use whatever code you have if user (doest not) exists inside success.

So basically move the logic/code what to do when user exists/doesn't exist inside success callback.
For more insights you really should read up some of the links provided in the comments

Edit:
I think you miss understand the concept of an asynchronous request - given the comments in your code

$.ajax({
    type:"post",
    url:"actionn.php",
    data:"name="+name,
    success:function(data){
        alert(data);        
        //if data does not exist means it should get out of ajax function
        //ajax function has already "exited" here is the success callback
        //this code is executed when the request to action.php was succesfull
        //as in response code is 200/OK

    }
});
//return false; //if data exists
//nope, you don't know if data exists this code will be
//executed _while_ (!) a request to action.php is made!
//there is no guarantee when this request returns and you can't write code
//here which relies on the response

//if(name=="") //data does not exist means it should come here
//{
//    alert("Please enter your Name");
//    return false;
//}

What you actually want to write is something like this:

$.ajax({
    type:"post",
    url:"actionn.php",
    data:"name="+name,
    success:function(data){
        if(name==""){
            alert("Please enter your Name");
        }else{
            alert("Your name is: "+data);
        }
    }
});

Crisp and short. All the logic depending on server's response is handleded inside successcallack. There is no code after $.ajax which is in any way dependant on data.

Please refrain from returning in $.ajax.success - it's not what you believe it is

For further question I'd like to invite you (again) to read up about Ajax call's: https://stackoverflow.com/a/14220323/1063730 I think the paragraph about restructuring code is highly interesting for you.