Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

133
Visualizações
Javascript checking country code keeps refreshing constantly

My current code checks the country code and then changes the drop down value before submitting it for the things to refresh in right currency pricing, but I've tried things like, putting return; to stop it after running it once and moving return; on different line with no luck. I even combined the .val line with .change() thinking maybe having it on separate lines was running it multiple times and refreshing it multiple times.

Here is my code;

$.ajax({
  url: "https://ipinfo.io/json",
  type: "GET",
  success: function(location) {


    if (location.country === 'AU') {
     $(".shopify-currency-form select").val("AUD").change();
} else if (location.country === 'AR') {
     $(".shopify-currency-form select").val("ARS");
} else if (location.country === 'CA') {
   $(".shopify-currency-form select").val("CAD");
} else if (location.country === 'US') {
   $(".shopify-currency-form select").val("USD").change();
}
return;
}
} );

$('.shopify-currency-form select').on('change', function() {
$(this)
    .parents('form')
    .submit();
return;
});
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda