I'm using the npm module ajax-request, and I'm having trouble storing the data. I have a feeling I'm just not grasping callbacks properly, but have followed examples, yet still to no avail. Any help would be greatly appreciated.
var productData = 'test';
function sendajax() {
    ajax({
        url: url,
        method: 'GET',
    }, (err, res, body) => {
        // Callback function
        returnData(body);
    });
}
function returnData(data) {
    // set variable
    productData = data;
}
alert(productData);
