I am trying to implement Semantic-UI search functionality with the autocomplete where results are populated using PHP - Laravel Framework
HTML:
<div class="three wide field ui search" id="reportingManager">
<label>Reporting Manager</label>
<input class="prompt" type="text" name="reportingManager" placeholder="Reporting Manager" value="{{$user->reportingManager}}">
<div class="results"></div>
</div>
Javascript:
$('#reportingManager')
.search({
apiSettings: {
url: '{{url()}}/master/getUsers/?q={query}'
}
})
;
Laravel Routes:
Route::get('master/getUsers/?q={query}', 'Masters\UserController@autoCompleteUsers');
Controller:
public function autoCompleteUsers($search) {
$search = "%".$search."%";
$users = User::where("firstName", "like", $search)->get();
return json_encode($users);
}
Currently, this is what I have, however, as for now it seems that either there is something wrong with my routes.php file or incorrect implementation of Semantic-UI.
Error:
GET http://localhost:8888/master/getUsers?q=a 404 (Not Found)
API: Server gave an error: error http://localhost:8888/git/crm.v2/public/master/getUsers/?q=a
Search: There was an error with your request [div#reportingManager.three.wide.field.ui.search.focus, context: div#reportingManager.three.wide.field.ui.search.focus] Object {readyState: 4, responseText: "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">…was not found on this server.</p>↵</body></html>↵", status: 404, statusText: "Not Found"}
Can anyone help me with what am I doing wrong here?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire