Geo Location

Geo Location

Hi, I'm trying to retrive visitor latitude and longitude to pass like a parameter in a php script.

this is my code:

  1.    function getPosition(){
  2.     if (navigator.geolocation) {
  3.          navigator.geolocation.getCurrentPosition(getLatLong);
  4.     } else { 
  5.         x.innerHTML = "Geolocation is not supported by this browser.";
  6.     }
  7. }
  8.                function getLatLang(position) {
  9.                         var lat = position.coords.latitude;
  10.                          var long = position.coords.longitude;
  11.   
  12.                 }
now I would like have this 2 vars lat and long to put in a $.post:

  1.  function showSpot() {
  2.                   $.ajax({
  3.                       type: "POST",
  4.                       url: "includes/inizialize-map.php",
  5.                       data: {
  6.                           latitude:xxxxxxxxx,
  7.                           longitude:yyyyyyyyyy
  8.                       },
  9.                       success: function (data) {
  10.                           $("#showspot").html(data);
  11.                       }
  12.                   });
  13.               }
  14.