I need to have something like this ajax:
<script type="text/javascript">
function gettheresults() {
$.ajax({
type: 'post',
url : '{{ path("client_medical_category_search") }}',
data: 'asas',
success: function(result) {
console.log(result);
horsey(document.querySelector('#ssSearchParam'), {
suggestions: result,
limit: 10
});
}
});
}
gettheresults();
</script>
<input value="{{ ssSerachParam }}" id="ssSearchParam" name="ssSearchParam" type="text" class="form-control"
placeholder="{{'Search for clinic, treatment, doctor'|trans}}">
I am loading results via ajax from database. But it gets the results only after 1~3 seconds and it doesn't attaches to my input field anymore. If i do console.log(), i see the results are good. If i do without ajax, via PHP, it attaches ok. But i need this via ajax. What is the problem here, how can i make it to be attached to my search input field after delayed time?
I need horsey for fuzzyesearch. This ajax call is for mainly for horsey, that my fuzzysearch would have the results in which it would search. And it should append to my input field.
I have working only this part:
$(document).ready(function () {
void function () {
'use strict';
horsey(document.querySelector('#ssSearchParam'), {
suggestions: ['airia', 'argentina', 'germany', 'etc'],
limit: 10
});
}();
});
I need to get the suggestions to horsey via ajax.