js: use jsonp to get remote jsonp sources (#47869)
This commit is contained in:
parent
29728ef0c0
commit
19d17c7c03
|
@ -379,9 +379,15 @@ $(function() {
|
|||
options.placeholder = '...';
|
||||
options.allowClear = true;
|
||||
}
|
||||
var url = $(elem).data('select2-url');
|
||||
if (url.indexOf('/api/autocomplete/') == 0) { // local proxying
|
||||
var data_type = 'json';
|
||||
} else {
|
||||
var data_type = 'jsonp';
|
||||
}
|
||||
options.ajax = {
|
||||
delay: 250,
|
||||
dataType: 'json',
|
||||
dataType: data_type,
|
||||
data: function(params) {
|
||||
return {q: params.term, page_limit: 10};
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue