Here is an example from my app to do a ajax get request:
var getLink = '/my-get-link';
var getData={
_token: "{{ csrf_token() }}",
key: value
}
$.get(getLink, getData, function (response) {
var jsonResponse = $.parseJSON(response);
if (jsonResponse.error == 'OK') {
//do something with the data.
}
})
My Router (web.php) looks like this:
Route::get('/my-get-link',['uses'=>'SomeController@someFunction'];
My Controller Part:
class SomeController extends Controller{
public function someFunction(Request $request){
//some query
//You can use the dd() function to "dump and die" some data.
dd("we are here")
return $data;
}
}
Hope this helps.