I'm using DataTables to fill a table and need some data from a different source. So I started off with render and made a second ajax request by the ID's of what I need the name of. Here is my code, that will explain it more clearly.
$('#table').DataTable({
    "ajax": "/api/url",
    "language": {
        "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json"
    },
    "order": [[0, "asc"]],
    "pagingType": "simple",
    "responsive": {details: false},
    "bAutoWidth": true,
    "lengthChange": true,
    "scrollX": false,
    "aoColumnDefs": [{}],
    "columns": [
        {
            "data": "typ_name"
        },
        {
            "data": "mietpreise",
            render: function (data, type, row, meta) {
                let tmp = [],
                    currentCell = $("#table").DataTable().cells({
                        "row": meta.row,
                        "column": meta.col
                    }).nodes(0);
                data.forEach(function (item) {
                    $.get("/api/url2/" + item.preis_kundengruppe_id, function (row, status) {
                        tmp.push(row.data.kundengruppe_name);
                    });
                });
                console.log(tmp);
                return $(currentCell).text(tmp);
            }
        },
I'm expecting to have the value of kundengruppe_name in the array like ['case1', 'case2'] but in the console I get this
[]
0: "Endkunden"
1: "Händler"
length: 2
__proto__: Array(0)
So what I want is to find under 0 and 1 and not in the array as expected. What am I doing wrong? What's going on with the array?
 
    