i am new to laravel and ember js, and i am trying to create a todo application in which the server will only pass a json of the todo list, and ember js will do all the rendering of the html. there are different approaches to do this. and i am confuse on which one is the best practice on the server side. 1. rendering an empty view with ember js, and a custom script in the head or footer of the document. and then create an ajax request to a different route in which the server that will return a json, with the header content-type json/application, and afterwards render the html with the results. 2. using dd() function that renders the json with a custom js script, (something that i do not know how to do), and will return content-type text/html header.
here is my server side code:
web.php
Route::get('/', function () {
$tasks=\App\Task::get()->toJson();
$tasks=Response::Json($tasks);
dd($tasks);
});
Aucun commentaire:
Enregistrer un commentaire