I have been trying multiple methods to get the returned data from a $.get method but am having no luck. So far, the code below returns an alert with the data I want but what I want to achieve is setting the finalPublicIp variable to the returned data so that I may use this variable in other places.
var finalPublicIp = $.get("https://api.ipify.org/", function(data){
alert("Data: " + data);
});
Thank you for all help in advance.