Tengo un select2 para mostrar la lista de zonas horarias y establecer automáticamente el valor seleccionado, los códigos a continuación funcionan correctamente en el entorno de desarrollo (ASP MVC Net Core 3.1), Visual Studio 2019, pero no establece automáticamente el valor seleccionado cuando se ejecuta en CentOS 7, extraño para mí, alguien me puede dar un consejo?
$.ajax({ headers: { api_key: '@PTX.Models.AppSettingsModel.Application.API_Key', api_secret: '@PTX.Models.AppSettingsModel.Application.API_Secret' }, type: 'GET', url: getDeploymentPath() + '/User/Timezone/', dataType: 'json' }).done(function (data) { result = $.map(data, function (x) { return { id: x.id, text: x.text }; }); $("#timezone").select2({ data: result, placeholder: "Select timezone", escapeMarkup: function (markup) { return markup; } }); $('#timezone').val(_timezone_id); $('#timezone').select2().trigger('change'); // Have tried below, but no luck :( //$("#timezone").select2('data', { id: _timezone_id, text: _timezone_text }); //$('#timezone').val(_timezone_id).trigger('change'); });