function useIpService() {
  var xhr = createCORSRequest('GET', 'https://ipapi.co/json/');
  if (!xhr) {
    throw new Error('CORS not supported');
  }
  xhr.onload = function () {
    var geoData = JSON.parse(xhr.responseText);
    getWeatherData(geoData.latitude, geoData.longitude);
  };
  xhr.onerror = function () {
    window.alert('Woops, there was an error making the ip request.');
  };
  xhr.send();
}
// Get user IP through IP service
Get user IP through IP service
Get user IP through IP service
function useIpService() {
  var xhr = createCORSRequest('GET', 'https://ipapi.co/json/');
  if (!xhr) {
    throw new Error('CORS not supported');
  }
  xhr.onload = function () {
    var geoData = JSON.parse(xhr.responseText);
    getWeatherData(geoData.latitude, geoData.longitude);
  };
  xhr.onerror = function () {
    window.alert('Woops, there was an error making the ip request.');
  };
  xhr.send();
}
function useIpService ( ) { var xhr = createCORSRequest ( 'GET' , 'https://ipapi.co/json/' ) ; if ( ! xhr ) { throw new Error ( 'CORS not supported' ) ; } xhr . onload = function ( ) { var geoData = JSON . parse ( xhr . responseText ) ; getWeatherData ( geoData . latitude , geoData . longitude ) ; } ; xhr . onerror = function ( ) { window . alert ( 'Woops, there was an error making the ip request.' ) ; } ; xhr . send ( ) ; }
Get user IP through IP service
Get user IP through IP service