Question: ```
   function ajaxRefresh(actionUrl) {
        $.ajax({
        url: actionUrl,
        success: function() {
             return true;
        }});
        return false;
    }

```

The function anyway returns `false` even when a request is succeeded, becouse the request is asynchronous. How I can return `true` when request is succeeded?

Answer: 
You can refactor your code a little bit so that your success callback triggers the next operation that depends on the true/false result. For example, if you currently have something like:

```
function main() {
  // some code

  if (ajaxRefresh(url)) {
    // do something
  }
}

```

You would change that to something like:

```
function main() {
  // some code

  ajaxRefresh(url);
}

function doSomething(successFlag) {
  if (successFlag) {
    // do something
  }
}

function ajaxRefresh(actionUrl) {
  $.ajax({
         url: actionUrl,
         success: function() {
           doSomething(true); // or false as appropriate
         }});
}

```

You could also put the `if` test into the ajax callback function instead of in the `doSomething()` function. Up to you.

Or you can make a synchronous request, and figure out the `ajaxRefresh()` function's return value after the request is done. I would not recommend that for most purposes.
Use call back functions

Callback Function Queues:-

The beforeSend, error, dataFilter, success and complete options all accept callback functions that are invoked at the appropriate times.

so, here 

```
function ajaxRefresh(actionUrl) {
        $.ajax({
        url: actionUrl,
        success: function() {
             return true;
        }
        error:function(){
             return false;
        }
     });        
    }

```

You can get more details here

<http://api.jquery.com/jQuery.ajax/>