select2 server side
$('#payment_method').select2({
placeholder: 'Select a option',
ajax: {
url: 'ajax_get_url',
dataType: 'json',
type: 'GET',
processResults({ data }) {
return {
results: $.map(data, function (item) {
return {
text: item.name,
id: item.id,
}
})
}
}
}
});
Are there any code examples left?
New code examples in category Other