This is my HTML Code:
<input autocomplete="off" type="text" id="chiefComplaintInput" name="chiefComplaintInp" class="typeahead-chiefcomplaint form-control input-circle-right" placeholder="Chief Complaints">
This is my Jquery bloodhound and typeahead code:
var chiefComplaints = new Bloodhound({
datumTokenizer: function(resp) {
return Bloodhound.tokenizers.whitespace(resp.value);
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
wildcard: '%QUERY',
url: "/opd/searchChiefComplaints/",
transform: function(response) {
return $.map(response, function(restaurant) {
return { value: restaurant.name };
});
}
}
});
$('input#chiefComplaintInput').typeahead({
hint: false,
highlight: true,
minLength: 2,
limit: 10
},
{
name: 'chiefComplaints',
display: 'value',
source: chiefComplaints,
templates: {
header: '<h4 class="dropdown">Restaurants</h4>'
}
});
This is the routes that i ahve defined:
Route::get('opd/searchChiefComplaints/{queryParam}', 'OpdController@searchChiefComplaints');
This is the controller code:
public function searchChiefComplaints(Request $request)
{
// return Response::json($request->get('queryParam'));
return $request->get('queryParam');
}
What i am trying to achieve is that i want to send post request to the controller and receive the JSON in response. Bu i am having problem attaining it i dont know where my code is going wrong :(
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire