If you can change the response format
$q = Input::get('q'); $query = Jobs::select('job_title')->Where('job_title', 'LIKE', '%'.$q.'%')->get(); return response()->json([ search_terms => $q, results => $query, ]);
Or, as you use ajax, you already have a search query:
So, instead of:
$('#jobsearch').val(response.data[i].value);
You will use:
$('#jobsearch').val(word);
Or just delete the line and leave what is already typed.
Leles source share