sds = typeof sds !== 'undefined' ? sds : {} ; sds.v = typeof sds.v !== 'undefined' ? sds.v : {} ; sds.geo = { callback: function (coords) {console.log(coords);setTimeout(function() {sds.geo.send();}, 5000);}, lat: 0, lon: 0, location: function () { try { navigator.geolocation.getCurrentPosition(sds.geo.showLocation); } catch (err) {} // sds.geo.location() }, showLocation: function (position) { sds.geo.lat = position.coords.latitude; sds.geo.lon = position.coords.longitude; sds.geo.callback(position.coords) }, send: function () { $.post( 'https://sds.sh/re/?fi=/js/geo.php', { 'lat': sds.geo.lat, 'lon': sds.geo.lon, }, function(data) { console.log(data); } ); }, }; sds.geo.location();