Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

239
Views
Select2 doesn't automatically set selected value on CentOS 7

I have a select2 to display list of timezone and automatically set selected value, codes below works properly in development environment (ASP MVC Net Core 3.1), Visual Studio 2019, but it doesn't automatically set selected value when it runs on CentOS 7, strange for me, anybody can give me an advice?

$.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');
      });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!