SyntaxFix
Write A Post
Hire A Developer
Questions
Try this one:
var data = [{id: 1, text: 'First'}, {id: 2, text: 'Second'}, {...}]; $('select[name="my_select"]').empty().select2({ data: data });