Getting Data from Multiple .then Statements in Javascript

By Forrest Smith -

I always have a hard time pulling data through multiple .then statements in javascript. This method works sufficiently well. Basically, define an array/object, and then as data is collected, add content to that array. All of the collected content should be available in the final .then statement. Something like this (all the data is collected into the viewData variable):

data = {};
data['table'] = 'tableName';

var viewData = {};
viewData['table'] = data;

viewData['columns'] = columnData;
viewData['values'] = rowData;