Fixed async menu loading
This commit is contained in:
parent
789f300237
commit
da5d884605
|
@ -10,18 +10,16 @@ $('#{{widget_id}}').selectize({
|
||||||
create: false,
|
create: false,
|
||||||
|
|
||||||
load: function(query, callback) {
|
load: function(query, callback) {
|
||||||
console.log('Desperately seeking ' + query);
|
if (query === null || !query.length || query.length < 5) return callback();
|
||||||
if (query === null || !query.length) return callback();
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/json/auto/search-strings-{{entity}}?{{field}}=' + query,
|
url: '/json/auto/search-strings-{{entity}}?{{field}}=' + query,
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'json',
|
||||||
error: function() {
|
error: function(xhr, status, error) {
|
||||||
console.log( 'Query ' + query + ' failed.');
|
console.log( 'Query `' + query + '` failed with status: `' + status + '`; error: `' + error +'`');
|
||||||
callback();
|
console.dir(xhr);
|
||||||
},
|
},
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log('Received ' + res + ' records for ' + query);
|
|
||||||
callback(res);
|
callback(res);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue