I have a list of product (about 18000) so I like to load some of them with the autocomplete when user tape S I have item contain S
here is my code
<div class="chzn-panel">
<select id="nomenclature_pv_recherche" name="nomenclature_pv_recherche" data-placeholder="<?php echo JText::_('COM_TKTRANSIT_DOSSIER_PV_NOMENCLATURE'); ?>" class="chzn-select-deselect" style="width: 256px;">
<?php
//echo JHtml::_('select.options', TkTransitHelper::getOptionsWithFieldName('nomenclature',"code",JText::_('COM_TKTRANSIT_DOSSIER_PV_NOMENCLATURE_OPTION')),'value', 'text', '');
//echo JHtml::_('select.options', array(),'value', 'text', '');
?>
<option value="">- Select Option -</option>
</select>
</div>
<script type="text/javascript">
$("#nomenclature_pv_recherche").chosen({allow_single_deselect:true});
</script>
and for Javascript I have this
$("#nomenclature_pv_recherche").chosen();
$('#nomenclature_pv_recherche input').autocomplete({
source: function( request, response )
{
alert(request);
alert(response);
$.ajax({
url: 'index.php?option=com_tktransit&task=privileges_fiscaux.getNomenclatureWithString',
data: {nomenclature:request.term},
dataType: "json",
success: function( data )
{
$('#nomenclature_pv_recherche').empty();
response( $.map( data, function( item )
{
$('#nomenclature_pv_recherche').append('<option value="'+item.id+'">' + item.code + '</option>');
}));
$("#nomenclature_pv_recherche").trigger("chosen:updated");
}
});
}
});
I don't know why I have no alert, no Ajax applet
What's wrong?
Jquery 3.5.1 JqueryUI 1.12.1 chosen 1.8.7 Thank you
You can see DEMO