Select2 - Getting select2.full.min.js?ver=1.0.0:2 Uncaught TypeError: Cannot read property 'length' of undefined error

Select2 - Getting select2.full.min.js?ver=1.0.0:2 Uncaught TypeError: Cannot read property 'length' of undefined error

I think I'm almost there! I am getting expected result from my php script for the following code; but for some reason, I'm getting following error:

  1. select2.full.min.js?ver=1.0.0:2 Uncaught TypeError: Cannot read property 'length' of undefined
  2.     at d (select2.full.min.js?ver=1.0.0:2)


-----
$("#jobSkills").select2({
ajax: {
url: ajax_object.ajax_url + "?action=autoSkills",
dataType: 'json',
delay: 250,
type: 'POST',
data: function (params) {
return {
skill: params.term,
page: params.page
};
},
processResults: function (data, params) {

params.page = params.page || 1;
console.log(data);

return {
results: data.items,
pagination: {
more: (params.page * 30) < data.total_count
}
};
},
cache: true
},
minimumInputLength: 1,
tags: "true",
tokenSeparators: [',', '#'],
maximumSelectionLength: 3,
placeholder: "Ex. Java, MS Office, SEO"
//data:
});

I figured out that the problem is most likely with results: data.items line.