I made a blog using laravel and php. In my main page I show all my posts from my database at once. I want to load my posts one at a time kinda like facebook does. I am using jquery ajax methods but I don't have a clear picture of how should I code it.
This is how I am trying to do it in my controller
// retrieve all the post from the database
$posts = DB::table('posts')->get();
return response() //what should I add here
// what should I do next
on the html side
$.ajax('/', {dataType: html}).done();
I want response as html and I am going to prepend it to the body.