How do you get the currency symbol based on ipinfo provides?

Viewed 34

I am trying to get the currency symbol based on ipinfo provides using javascript. So far I am able to get the countries' names and other info from ipinfo using the following code below, but I need to find a way to use these infos to know the currency used on that particular country.

$.get("https://ipinfo.io", function(response) {
    alert(response.country);

}, "jsonp");
1 Answers

Does this answer your question?

$.get("https://ipinfo.io", function(response) {
    $.get("https://restcountries.eu/rest/v2/alpha/"+response.country.toLowerCase(), function(res) {
        console.log(res.currencies);
    });
}, "json");
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

Related