load dynamic library '...\\ext\\php_curl.dll' - \xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd.\r\n in Unknown on line 0
$('#sity').select2({
ajax: {
url: "https://api.vk.com/method/database.getCities",
type: 'GET',
dataType: 'jsonp',
delay: 250,
data: function (params) {
return {
country_id: 1,
q: params.term // search term
};
},
processResults: function (data) {
var items = $.map(data.response, function(item, i, params) {
var reg = (item.region) ? ' (' + item.region + ')' : '';
var title = item.title + reg;
return {
id: item.cid,
text: title
};
});
return {results: items};
}
},
maximumSelectionLength: 1
});
$('#sity').select2({
ajax: {
url: "https://api.vk.com/method/database.getCities",
type: 'GET',
dataType: 'jsonp',
delay: 250,
data: function (params) {
return {
country_id: 1,
q: params.term // search term
};
},
processResults: function (data) {
return {
results: data.response
};
}
},
maximumSelectionLength: 1
});
data: function (params) {
return {
country_id: 1,
q: params.term // в это место подставлялся запрос из поля и подгружались новые данные
};
},
var valueList;
valueList = $('#sity').select2({
ajax: {
url: "https://api.vk.com/method/database.getCities",
type: 'GET',
dataType: 'jsonp',
delay: 250,
data: function (params) {
return {
country_id: 1,
q: params.term // search term
};
},
success: function (data) {
initValueList(data.response);
}
},
maximumSelectionLength: 1
});
function initValueList(data) {
valueList.html
(
$(data.reduce(function(cid, title, region) {
var reg = (region) ? ' (' + region + ')' : '';
return '<option value="' + cid + '">' + title + reg + '</option>';
}, ''))
);
valueList.val(null).trigger('change');
}
Uncaught ReferenceError: jQuery1124003864469288968775_1480858544606 is not defined
at database.getCities?callback=jQuery1124003…_1480858544606&country_id=1&q=в&_=148085854…:1
success: function (data) {
console.log(data);
}
var valueList;
valueList = $('#sity').select2({
ajax: {
url: "https://api.vk.com/method/database.getCities",
type: 'GET',
dataType: 'jsonp',
delay: 250,
data: function (params) {
return {
country_id: 1,
q: params.term // search term
};
},
success: function (data) {
return initValueList(data.response);
}
},
maximumSelectionLength: 1
});
function initValueList(data) {
for (var i in data) {
var region = (data[i]["region"]) ? ' (' + data[i]["region"] + ')' : '';
var cid = data[i]["cid"];
var title = data[i]["title"];
valueList.html
(
$(function(cid, title, region) {
return '<option value="' + cid + '">' + title + region + '</option>';
}, '')
);
valueList.val(null).trigger('change');
}
}