I have 2 functions, one that looks up the users IP address and another that finds information based off of that. The first I have like this:
<script type="application/javascript">
function getIP(json) {
console.log(json.ip)
}
</script>
<script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=getIP"></script>
<script>
function getLocation(json) {
console.log(json.region);
}
</script>
<script type="application/javascript" src="https://json.geoiplookup.io/"+ IPADDRESS +"?callback=getInfo" id="test"></script>
Where the second ones script tag has IPADDRESS I need the IP address from the first to be if I use document.getElementById()
it has to be above the script which is not allowed. Is there a way I can just define a variable and then use it as I have with IPADDRESS