Skip to content

Instantly share code, notes, and snippets.

@cschmidt
Last active December 11, 2015 08:58
Show Gist options
  • Save cschmidt/4577035 to your computer and use it in GitHub Desktop.
Save cschmidt/4577035 to your computer and use it in GitHub Desktop.
Use the MaxMind GeoIP Javascript API to assign the country to a hidden form field
<script src="http://j.maxmind.com/app/country.js" charset="ISO-8859-1" type="text/javascript">
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#country').val(geoip_country_code());
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment