0
이 내 HTML 코드입니다 :선행 입력 및 블러드 하운드 포스트 요청이 Laravel에서 작동하지 않는 것은 5
<input autocomplete="off" type="text" id="chiefComplaintInput" name="chiefComplaintInp" class="typeahead-chiefcomplaint form-control input-circle-right" placeholder="Chief Complaints">
이 내 JQuery와 블러드 하운드와 선행 입력 코드 : 이것은 내가 정의 ahve 경로입니다
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>'
}
});
:
Route::get('opd/searchChiefComplaints/{queryParam}', '[email protected]');
이 컨트롤러 코드는 다음과 같습니다
public function searchChiefComplaints(Request $request)
{
// return Response::json($request->get('queryParam'));
return $request->get('queryParam');
}
내가 달성하려고하는 것은 컨트롤러에 게시물 요청을 보내고 응답으로 JSON을 받기를 원한다는 것입니다. .. BU 내가 문제를 내가 잘 모릅니다 그것을 달성하는 데 문제 PR 어디에 내 코드를 참조하십시오 당신은 $request->input()
를 사용해야합니다 JSON 데이터가 $request->get()
읽을 수 없습니다 게시
google 크롬 '네트워크'탭에서 검사하여 백엔드에 대한 요청을 분석합니다. 여기에 respone 섹션에서 일부 정보를 볼 수 있습니다. 또한 laravel 폴더에서 로그 파일을 분석하여 잘못된 것을 확인하십시오. –
Nopes는 모든 응답을 시도하지 않았습니다. –