So this is my code
$('.tags').select2({
placeholder: "Palabras Clave",
ajax: {
url: '/cotizacion/buscartags',
data: function (params) {
var query = {
q: params.term,
}
return query;
},
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.Tag,
id: item.Tag,
data: item
}
})
};
}
},
minimumInputLength: 3,
maximumSelectionLength: 5,
tags: true,
tokenSeparators: ['|'],
language: {
// You can find all of the options in the language files provided in the
// build. They all must be functions that return the string that should be
// displayed.
inputTooShort: function () {
return "Introduzca un minimo de tres caracteres";
},
searching: function () {
return "Buscando";
}
}
});
If the server throws an error lets say a 500 i get this legend “the results could not be loaded”, and that’s it i just need to add whatever the user is searching for, the behavior is different from “no tags found” to server error, i’m without a clue on how to do this, thanks in advance.