You controller method should be called getAvailableResponders
not searchResponders
.
And you probably need to return json_encode($results)
, not echo
them.
How would the controllermethod be called? Could you make up an example please? I changed to return json_encode, but it doesn't change
You specify the method to call in your routes:
Route::post('searchResponders', 'RespondersController@getAvailableResponders');
That getAvailableResponders
after @
is the method that will called.
The method is specified in my routes file. But I can't directly call that method, as then the app would search for a wrong URL /getAvailableResponders
You should use return response(); If you could use route() helper on that ajax url, that would be great.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community