I'm looking to populate a field on a Nintex Form with the users Public IP Address. I have found several examples of how to do this with javascript but I am unable to convert it over into the Nintex form. Our SharePoint environment is 2019 and on Prem so method 1 below is doing a postback which will not work since the site is internal and example 2 also throws an error so the alert never fires
Example 1
<script type="application/javascript">
function getIP(json) {
document.write("My public IP address is: ", json.ip);
}
</script>
<script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=getIP"></script>
Example 2
const xhttp = new XMLHttpRequest();
xhttp.onload = function() {
alert(this.responseText);
}
xhttp.open("GET", "https://api.ipify.org/", true);
xhttp.send();