I have a js function , after doing some business logic, the javascript function should return some result to another variable.Sample code below

```
var response="";
function doSomething() {  
    $.ajax({
        url:'action.php',
        type: "POST",
        data: dataString,
        success: function (txtBack) { 
            if(txtBack==1) {
                status=1;
            }
    });
    return status;     
}

```

Here i want to use like 

```
response=doSomething();

```

I want to assign a return value "status" "var response".But the result is 'undefined'.