title: geolocation cordova can't get a latitude
body: <p>i'm using cordova geolocation, and i need to get a coordinates values outside of a function. Ex latitude value. But it doesn't works.</p>
  
  <p>I've tried diferent ways but no one works .</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Device Properties Example&lt;/title&gt;
  
      &lt;script type="text/javascript" charset="utf-8" src="cordova.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" charset="utf-8"&gt;
  
  
  
          navigator.geolocation.getCurrentPosition(onSuccess, onError);
  
  
      // onSuccess Geolocation
      //
      function onSuccess(position) {
          var element = document.getElementById('geolocation');
          element.innerHTML = 'Latitude: '           + position.coords.latitude              + '&lt;br /&gt;' +
                                      'Longitude: '          + position.coords.longitude             + '&lt;br /&gt;';
  
  
      var lat = position.coords.latitude;
      var lon = position.coords.longitude;
  
                             }
  
      function onError(error) {
          alert('code: '    + error.code    + '\n' +
                'message: ' + error.message + '\n');
      }
  
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;p id="geolocation"&gt;Finding geolocation...&lt;/p&gt;
      &lt;script&gt;alert (lat);&lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>