Answers for "select2 server side"

4

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,
                            }
						})
					}
				}
			}
		});
Posted by: Guest on July-16-2020

Code answers related to "select2 server side"

Browse Popular Code Answers by Language