Кажется, я не могу манипулировать dom, когда я делаю этот запрос ajax, после запроса ajax я хочу манипулировать элементами управления, но я не могу заставить его работать. ' используя элемент управления int-tele-input jquery, и я пытаюсь добавить метку в элемент управления вводом после выполнения запроса ajax.
geoIpLookup: function(callback) {
let self = $(this).intlTelInput('getInstance');
// self give me the jquery instance but I can't seem to manipulate the dom
$.get('https://ipinfo.io?token=1', function() {}, "jsonp").always(function(resp) {
var countryCode = (resp && resp.country) ? resp.country : "";
callback(countryCode);
var exampleNumber = intlTelInputUtils.getExampleNumber(countryCode, true, intlTelInputUtils.numberType.FIXED_LINE);
setTimeout(function(self, exampleNumber) {
// this call here does nothing after a period of time
self.closest('.control-tele-input').find('.iti--allow-dropdown').append($('<label class="placeholder"><i class="fas fa-phone-alt"></i> Phone<sup class="font-red">*</sup> e.g. ' + exampleNumber + '</label>'));
}, 1000, self, exampleNumber);
console.log(countryCode);
});