We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First of all: The dropdown and AJAX call is all working fine. Thanks Typeahead.js.
Issue When I select an item from my dropdown, the full JSON object is being parsed in the textfield/searchfield.
My data is returned from PHP like: return response()->json($clients);
What am I doing wrong? Do I have to attach somewhere a json.parse?
function generateAjaxAutoCompleteTypeAhead() { var client_id = $('input[name="client_id"]').val(); var engine = new Bloodhound({ remote: { url: '/lookupclient?typehead_lookup_client=%QUERY%', wildcard: '%QUERY%' }, queryTokenizer: Bloodhound.tokenizers.whitespace, datumTokenizer: Bloodhound.tokenizers.whitespace }); $("input[name='typehead_lookup_client']").on('typeahead:selected', function (e, ui) { }); $("input[name='typehead_lookup_client']").typeahead({ hint: true, highlight: true, minLength: 3, },{ source: engine.ttAdapter(), name: 'resultList', limit: 20, templates: { empty: [ '<div class="list-group search-results-dropdown"><div class="list-group-item">Nothing found.</div></div>' ], header: [ '<div class="list-group search-results-dropdown">' ], suggestion: function (data) { return '<li class="list-group-item">' + data.city + ' - ' + data.zip_code + ' - ' +data.name + ' - ' + data.street_no + '</li>' } } } ); } generateAjaxAutoCompleteTypeAhead()
The text was updated successfully, but these errors were encountered:
I think you may need to define the display function for your dataset:
display
$("input").typeahead({ /*hint:, highlight:, etc. */ }, { source: engine.ttAdapter(), display: function (obj) { // Return your desired string } });
Sorry, something went wrong.
No branches or pull requests
First of all:
The dropdown and AJAX call is all working fine. Thanks Typeahead.js.
Issue
When I select an item from my dropdown, the full JSON object is being parsed in the textfield/searchfield.
My data is returned from PHP like: return response()->json($clients);
What am I doing wrong? Do I have to attach somewhere a json.parse?
The text was updated successfully, but these errors were encountered: