JSFiddle - React, Tailwind, and code Playground

by espyMur

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

JavaScript

let IPAddress, place; 
function getLocationInfos() {
    /*
     this function will get the will get location infos from an api
     the location info contain the Ip address and
    */
    let IP, atLocation;
    let IPCall = $.get('https://ipinfo.io', function (response) {
        IP = response.ip;
        atLocation = response.city + ' ' + response.region + ' ' + response.country
    }, 'jsonp').done(
         function (IPCall) {
        IPAddress = IP; //want to update global variables 
        place = atLocation; // want to update globales variables
        console.warn('the ip info are : %s , and %s inside', IPAddress, place);
    });
/// i want to get those wavlues here to update the global variables
    console.warn('the ip info are : %s , and %s', IPAddress, place);
}
getLocationInfos();

/// or here 
    console.warn('the ip info are : %s , and %s', IPAddress, place);