I have this in head:
<script>
$(document).ready(function(){
$.getJSON("http://freegeoip.net/json/", function(data) {
var country = data.country_name;
var ip = data.ip;
var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
$.ajax({
method:"POST",
url:"file.php",
data: {
userCountry:country,
userIp:ip,
vw:w
}
});
});
});
</script>
This is no file.php:
$maxwidth = $_POST['vw'];
$maxcountry = $_POST['userCountry'];
$maxip = $_POST['userIp'];
But POST never gets there. Does anyone help?