by ajasmin · 13y ago · 0 comments
$.ajax({url:"http://freegeoip.net/json", dataType:"json"})
.done(function(data){$('#city').text(data.city)});
freegeoip.net seems to send the "Access-Control-Allow-Origin: *" header which allows the cross-domain ajax call.Picking a city ~800km from where you are is an exercise left for the reader.