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