I need a solution for my simple js api.
I want to send the IP of the visitor on the same pageload when i populate the IP var with PHP.
<script>var ipadress=<?='"' . $_SERVER['REMOTE_ADDR'] . '";'?></script>
and de api file below needs this IP adres for a XMLHttpRequest on the same pageload without refreshing.
<script src="//mysite.com/js/api.js" defer></script>
Is this possible? PHP REMOTE_ADDR is server side en de js api is client side. Any suggestions? Or some work arround??
Thanks!!