I am successfully looping my data with ajax but when I console log I see my data sent in a new line.
$.ajax(settings).done(function(response) {
$.get(settings).then(data => makeTable(data.contracts))
const makeTable = (contracts) => {
const body = document.getElementById('chart');
contracts.forEach((person, index) => {
person.details.forEach((entry) => {
const arrayOfDigits = Array.from(String(entry.hours), Number);
chart.updateSeries([{
name: 'Hours',
data: [entry.hours]
}])
console.log(arrayOfDigits)
I also tried converting my integers into an object but it would come out as
[integer]
[integer]
[integer]
[integer]
[integer]
But what I would like to do is having it in the same object like so
[integer, integer, integer, integer]
2
Answers
Push
arrayOfDigits
into an array and log that at the end, rather than logging each one separately.Final code working as intended: