I try to use jquery chosen with ajax call : https://harvesthq.github.io/chosen/
My html is :
<div class="form-group m-b logiciel">
<label>Logiciel concerné</label>
<select id="logiciel" name="logiciel" class="chosen">
</select>
</div>
My first script is :
$(document).ready(function () {
$("#logiciel").load('ajax/ticket_add_select.ajax.php?id=' + $('#client').val());
$("#logiciel").trigger('chosen:updated');
$("#logiciel").chosen();
});
And my second one is (#ticket_type is another chosen) :
$(function () {
$('#client').on('change', function () {
var id = this.value;
$("#logiciel").load('ajax/ticket_add_select.ajax.php?id=' + id);
$("#logiciel").trigger('chosen:updated');
});
});
Everything works fine when i select something on my first select, but on the first load, the second select is empty. Ajax is ok, i can see the result on log.
Is someone achieve to do something like that ?