Dynamically change headline to include {CityName} based on IP Address in JavaScript Posted August 20, 2020 Hello, I am building a landing page on Wordpress and would like to use geolocation to change the headline based on user's IP address. I have tried this solution with Snoopi's API: <h1><span id="location">{CityName}</span></h1> <script> $('document').ready(function() { $.ajax({ url: "https://api.snoopi.io/check?apikey=XXX", // XXX = API Key dataType: "jsonp", jsonpCallback: "unBounce" }); }); // Ready function unBounce(json){ $('#location').html(json.City + ", " + json.State); } </script> **I am not using unBounce to build though and am not sure what to change that value to....? Any advice would be very helpful! Thank you!! Riley
Dynamically change headline to include {CityName} based on IP Address
in JavaScript
Posted
Hello,
I am building a landing page on Wordpress and would like to use geolocation to change the headline based on user's IP address. I have tried this solution with Snoopi's API:
**I am not using unBounce to build though and am not sure what to change that value to....? Any advice would be very helpful!
Thank you!!
Riley