Skip to content

Instantly share code, notes, and snippets.

@thomasgriffin
Created January 30, 2014 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasgriffin/8710900 to your computer and use it in GitHub Desktop.
Save thomasgriffin/8710900 to your computer and use it in GitHub Desktop.
jQuery.getJSON('http://freegeoip.net/json/', function(location) {
var d = new Date(),
curr_date = d.getDate(),
curr_month = d.getMonth(),
curr_year = d.getFullYear(),
fulldate = curr_date + "-" + curr_month + "-" + curr_year;
$('<input id="date" type="hidden" name="custom_date" value="' + full_date + '" />').appendTo($('#your-form-id-here'));
$('<input id="ip" type="hidden" name="custom_ip" value="' + location.ip + '" />').appendTo($('#your-form-id-here'));
$('<input id="country" type="hidden" name="custom_country" value="' + location.country_name + '" />').appendTo($('#your-form-id-here'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment