let oIP = null; $(document).ready(function () { $.getJSON("https://ip-api.io/api/json", function(data) { getIPData(data); }, 'json'); }); function getIPData(data) { oIP = data; }