Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

132
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda