I Have some problem while using Select2 Jquery Plugin cause its my 1st time use it.
$(".select-class").select2({
ajax: {
url: "",
dataType: 'json',
type: "POST",
data: function (term, page) {
return {
type: 'type_of_mine',
kelas : kelas,
jurusan : jurusan,
q: term
};
},
results: function (data, page) {
return { results: data.results };
}
},
initSelection: function (item, callback) {
var id = item.val();
var text = item.data('option');
if(id > 0){
var data = { id: id, text: text };
callback(data);
}
},
formatAjaxError:function(a,b,c){return"Not Found .."}
});
but i always got this error message on my console :
jquery.min.js:2 Uncaught Error: No select2/compat/initSelection(…)
can you help me please?? thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire