This is my code:
var user_ip ="not found";
$.get("http://ipinfo.io", function(response) {
var user_ip=response.ip;
alert("on line 749 user ip is " + user_ip);
}, "jsonp");
alert("on line 751 user ip is " + user_ip);
Yet my user ip only get saved within the .get, afterwards it always reverts to "not found".
I know this involves using a call back to save the data but cant find an example of how to do it that makes sense to me