0

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!!

2
  • Have you tried it? Commented Mar 20, 2020 at 18:21
  • Yes! No IP send on the first pageload Commented Mar 20, 2020 at 18:28

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.