$deliveryTypes = TableRegistry::get('delivtypes')->find('all')->select(array('TYPEID'))->toArray();
$empTypes = TableRegistry::get('emptypes')->find('all')->select(array('TYPEDESC'))->toArray();
$routes = TableRegistry::get('routes')->find('all')->select(array('ROUTEDESC'))->toArray();
return $this->response->withType('application/json')->withStringBody(json_encode(array_merge($deliveryTypes, $empTypes, $routes)));
I don’t know your data structure.
Parse the JSON string in your response with “JSON.parse()” and assign the results to different variables.
Depending on the ajax function you use this step isn’t needed. See: jQuery.getJSON().
You can do a console.log() to view the structure of the parsed JSON. NB. In JS objects AND arrays are passed by reference.
There are tons of information out there on this topic. Before asking a question i recommend using a search engine first. This way you get a faster answer. A good programmer knows how to use a search engine.