I am able to returned value in alert form from remote php script. However when I console.log(IPAddress) my value is undefined. My Goal is to establish value of IPAddress from json response. Always a single value in json response. Example: {"ip":"192.168.1.1"}
Here is my code:
var IPAddress = function(){
$.getJSON("http://domain.com/assets/php/get-ip.php/? callback=DisplayIP",function(data){
//alert(result['ip']);
//alert(data.ip);
return(data.ip);
});
}