Question: I have an ajax call that looks like this. My question is, with the callback function I can get the data out from myAjaxCall() to another function so I can work on the data. But is it possible to do multiple callbacks, so I can pass the data to two, three or four different functions that do all different things to the data?

Or do I have to do multiple ajax request for every function that I want to use?

```
function myAjaxCall() {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'myJSON.json', true);

    xhr.onload = function() {
        if(this.status === 200) {
            var data = JSON.parse(this.responseText);
            callback && callback(data);
        }
    };
    xhr.send();
}

```

Answer: 
You can just wrap the callbacks in another function and use that wrapper function instead:

```
function callback(data) {
    callbackOne(data);
    callbackTwo(data);
    callbackThree(data);
    . . . 
}

```

If you need broader use of `data` than this, you'd need to resolve a `Promise` or something similar to get the data into a broader scope.
why not just call different functions with data as a parameter, sth. like this:

```
function myAjaxCall() {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'myJSON.json', true);

xhr.onload = function() {
    if(this.status === 200) {
        var data = JSON.parse(this.responseText);
        functionA(data);
        functionB(data);
        functionC(data);
    }
};
xhr.send();
}

```

and inside your function do with data whatever you want to do:

```
functionA(data) {
   // TODO do sth. with data
}

```