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 should set parameter `async` to `false`. Try this code:

```
function ajaxRefresh(actionUrl) {
    var succeed = false;

    $.ajax({
    async: false,
    url: actionUrl,
    success: function() {
         succeed = true;
    }});

    return succeed;
}

```
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/>