jQuery select2 AJAX not working
The Select2 control is updated to version 4.0. Now input fields are not working any longer and there should be select
element.
The results have been changed to
processResults: function (data) { return { results: data }; }
Inside the processResults
function you can use them like this:
processResults: function (data) { var results = []; $.each(data, function (index, account) { results.push({ id: account.AccountID, text: account.AccountName }); }); return { results: results };}
Figured out its because i was using <select>
It has to be an <input>
for the ajax data to load...
<input type="hidden" id="cliselect" name="cliselect" style="width: 100%;" />