Question: I have some problem using ajax.

How can I assign all result from ajax into outside variable ?

I google it up and found this code..

```
var return_first = (function () {
    var tmp = null;
    $.ajax({
        'async': false,
        'type': "POST",
        'global': false,
        'dataType': 'html',
        'url': "ajax.php?first",
        'data': { 'request': "", 'target': arrange_url, 'method': method_target },
        'success': function (data) {
            tmp = data;
        }
    });
    return tmp;
});

```

but not work for me..

Can anybody tell what is wrong about that code ?

Answer: 
You are missing a comma after

```
'data': { 'request': "", 'target': 'arrange_url', 'method': 'method_target' }

```

Also, if you want `return_first` to hold the result of your anonymous function, you need to make a function call:

```
var return_first = function () {
    var tmp = null;
    $.ajax({
        'async': false,
        'type': "POST",
        'global': false,
        'dataType': 'html',
        'url': "ajax.php?first",
        'data': { 'request': "", 'target': 'arrange_url', 'method': 'method_target' },
        'success': function (data) {
            tmp = data;
        }
    });
    return tmp;
}();

```

Note `()` at the end.
I have changed previous response a little and this solution have been working for me.

```
function searchlipcutforbrace(cs,id_pff,wt,ofl){
    var params = {
       "cs"  : cs,
       "id"  : id_pff,
       "wt"  : wt,
       "ofl"  : ofl
       }

var response = $.ajax({
                    data:  params,
                    url:   'ajax/searchlipcutforbrace.php',
                    async: false,
                    dataType: 'json',
                    success: function (json) {
                        response = json;
                    },
                    type:  'post'
                });    
    return response.responseJSON;
}

```