Search code examples
javascriptjquerygeolocation

the server responded with a status of 429 (Too Many Requests) intlTelInput.js


I am using intlTelInput.min.js for geo IP lookup with this code

jQuery("#teephnumber").intlTelInput({
        allowExtensions: true,
        defaultCountry: "auto",
        setNumber: "Telephone number",
        geoIpLookup: function(callback) {
            $.get('http://ipinfo.io', function() {}, "jsonp").always(function(resp) {
              var countryCode = (resp && resp.country) ? resp.country : "";
              callback(countryCode);
            });
          },
        nationalMode: false,
        utilsScript: "/wp-content/themes/imc/js/utils.js"
    });

it was working fine, but now not in console I see this error:

The server responded with a status of 429 (Too Many Requests), GET http://ipinfo.io/?callback=jQuery1112025137682701461017_1438183879450&_=1438183879451

And no javascript code because of this works.What can be the reason for this?


Solution

  • See Rate limits here: https://ipinfo.io/developers

    "You are limited to 1,000 API requests per day. If you need to make more requests, or need SSL support, see our paid plans."

    I think you need to pay for more requests or find a way to reduce the requests you are making. You can probably cache the location so you only query once per user using localstorage.