Javascript Array Array.push JSON.parse(jsonobject) gives back weird array [duplicate]

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
 function DrawGraph(CanvasIdName/*text*/,proxyUrl/*proxy to pull data from herefor there needs to be a proxy server set up with a json format*/,dataName/*name of object in the json*/,height/*number*/, width/*number*/,spacing/*ammount of data points in lefttable*/,lineWidth/*float*/, lineColor/*text/rgb(r,g,b)/rgba(r,g,b,a)/hex*/,drawGuidingLines/*boolean*/) {

    let data = [];
    $.ajax({type: "GET", url: proxyUrl, datatype: "json",success: function(json){
    var obj = JSON.parse(json);
    for(var k in obj)
    data.push(obj[k][dataName]);
    }});

    console.log(data); /*this is important!!!!!!!!!!!!!!!!!!!!! FOR THE STACKOVERFLOW POST*/
    
    const canvas = document.getElementById(CanvasIdName);   //get the canvas
    const ctx = canvas.getContext("2d");                    //set canvas to ctx and define it as 2d
    ctx.strokeStyle = "rgb(255,0,0)";                       //set color of line to chosen value
    
    let maxHeight = height/Math.max(...data);               //set height stepvalue
    let maxWidth = width/data.length;                       //set width stepvalue
    
    let x = 0;                                              //set startvalue to 0
    let ydata = 0;                                          //set startvalue to 0
    
    console.log(data[3]);   //debug line
    
    if(drawGuidingLines == false) {                         //if you don't want to draw guidinglines draw the graph instead
        for(dataIndex in data) {
            ydata = height-(maxHeight * (data[dataIndex])); //get height position
            ctx.lineTo(x, ydata + maxHeight * 2.5);         //draw draw the line
            x += maxWidth;
            console.log(data[dataIndex]);   //debug line
        }
        ctx.stroke();
    }
    
 }
    DrawGraph("canvasTest","proxy.php?q=lastday","TempertureS01",350,450,5,0.5,"rgb(255,0,0)",false);
</script>

Here you have a snippet of the proxy reply

[{"LocationId":"1","TempertureS01":"11.870","TempertureS02":"11.700","PressureS01":"102204.234","HumidityS02":"60.500","HeatIndexS02":"10.505","LightS00":"0.002","TimeStamp":"2021-12-21 20:29:44"},{"LocationId":"1","TempertureS01":"12.390","TempertureS02":"12.300","PressureS01":"102192.164","HumidityS02":"57.400","HeatIndexS02":"11.084","LightS00":"0.002","TimeStamp":"2021-12-21 20:01:13"},{"LocationId":"1","TempertureS01":"13.000","TempertureS02":"13.100","PressureS01":"102185.297","HumidityS02":"55.700","HeatIndexS02":"11.920","LightS00":"0.002","TimeStamp":"2021-12-21 19:32:45"},

Here is the Imgur link of the output for the devtools console

enter image description here

My biggest problem with this is the array, since the array doesn’t “contain” any items, I’ve never seen this problem before, I have looked for hours through the web, but maybe just can’t find the solution I’m looking for.