Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.