Answer the question
In order to leave comments, you need to log in
How to return an array in which one of the elements is the result of view()?
Good morning everyone, and maybe not good after reading the question)
I know what I'm doing is fundamentally wrong, but now there is no time to do it normally from the word at all.
Question: there is a controller to which it throws an ajax request, the controller fulfills the view and throws back the finished html, but when I send not only html, but an array of html and some variable, then instead of html comes emptiness, and the second variable is normal, actually how to send an array with such data?
In the end, I just need to send two different pieces
of
html
$items[$table] = view('worktable.w_dop_table', ['items' => $items[$table], 'table' => $table]);
return $items[$table];
$items['li'] = view('li_for_table',['items' => $items[$table], 'table' => $table]);
$items[$table] = view('worktable.w_dop_table', ['items' => $items[$table], 'table' => $table]);
return $items;
Answer the question
In order to leave comments, you need to log in
Answer to my question found
$view = [
'li' => view('li_for_table',['items' => $items[$table], 'table' => $table])->render(),
'table' => view('worktable.w_dop_table', ['items' => $items[$table], 'table' => $table])->render()
];
return $view;
$view = [
'li' => view('li_for_table',['items' => $items[$table], 'table' => $table]);,
'table' => view('worktable.w_dop_table', ['items' => $items[$table], 'table' => $table]);
];
return new Response($view);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question