Level 7
Something like this?
$.get('/mylists', function( result ) {
// do something with the result
});
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
So i do a curl request to my api and I am returned with a Vegetables_list
next i just json decode and return it as $data in my ExampleControllers mylists method. so when i browse to my route http://localhost/mylists I see json data it works cool.
So I have another route called Index that points to index.blade , What i want to do is to have inside my index.blade a jquery ajax request to get json data from mylists route and than format the json output to display inside a html table.
can anyone help
Route::get('mylists', 'ExampleController@mylists');
Route::get('index', function () {
return view('index');
});
public function mylists()
{
\\ some curl calls to get data from my api next
return $data = json_decode($Vegetables_list)
}
Please or to participate in this conversation.