title: Get ip address from JSON/jquery
body: <p>I have following Code for Get IP address i want to store that data.ip with global scope that i can access anywhere in file.</p>
  
  <pre><code> &lt;script&gt;
  ip = null;
  $.getJSON("http://jsonip.appspot.com?callback=?",
    function(data){
         ip = data.ip;
  alert(ip); //return ip address correctly
    });
  alert(ip); //undefined or null
  &lt;/script&gt;
  </code></pre>