V
V
Vladimir Golub2015-05-17 11:25:52
PHP
Vladimir Golub, 2015-05-17 11:25:52

Is it possible to do two outputs for AJAX in one php script?

For example, display orders from 2 tables at a time.

echo json_encode(array("ordersprint" => $orders_print));
echo json_encode(array("ordersdesign" => $orders_design));


And on the client to pass them by a cycle.

success: function(json){
$.each(json.ordersprint,function() {
......
$.each(json.ordersdesign,function() {
......
}


Or it is possible only after the output of 1 in success to prescribe a call to the second. Is it possible to combine this somehow.

Here's what comes backb1fa6b6bd1214d11b6830d89079ebcf6.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Appp Zooo, 2015-05-17
@RazerVG

echo json_encode(array("ordersprint" => $orders_print, "ordersdesign" => $orders_design));

//each можно  оставить тогда без указаний на имя индекса
$.each(json,function() {});
//или обратиться так без each
json[0] //or json['ordersprint']
json[1] //or json['ordersdesign']

Something like this?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question