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

131
Views
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
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!