title: Get IP address of visitor after an AJAX form submit
body: <p>I have an HTML form. When visitor submits form, a javascript method is invoked.
  This method sends an AJAX request to my server's php file.
  My problem is i need to get the visitor's ip address. But because of AJAX request calls php file, <strong>$_SERVER['REMOTE_ADDR']</strong> gives me my server's address.
  How can i get visitor's ip, in this case?
  Thank you</p>
  
  <pre><code>&lt;form onsubmit="sendData(); return false;"&gt;
      // some data here
  &lt;/form&gt;
  
  function sendData(){
      // do some work, get variables
      $.ajax({
          url:"/mypage.php",
          type:"GET",
          data: { name: e },
          success : function(data) {
             // do some work
          },
          error: function (xhr, ajaxOptions, thrownError) {
          }
      })
  }
  
  // in mypage.php
  public function useData() {
          $name=$_GET["name"];
          $ip = $_SERVER['REMOTE_ADDR'];
  }
  </code></pre>