Function 谷歌GClientGeocoder地理编码器功能-如何传递额外参数?

Function 谷歌GClientGeocoder地理编码器功能-如何传递额外参数?,function,asynchronous,maps,Function,Asynchronous,Maps,我正在使用谷歌GClientGeocoder地理编码功能。 方法getLocations似乎是一个Google异步回调函数 function fnGetEncoding(address,id) { // Create new geocoding object geocoder = new GClientGeocoder(); // Retrieve location information, pass it to getGeoCode() geocoder.getL

我正在使用谷歌GClientGeocoder地理编码功能。 方法getLocations似乎是一个Google异步回调函数

   function fnGetEncoding(address,id)
   {
  // Create new geocoding object
  geocoder = new GClientGeocoder();

  // Retrieve location information, pass it to getGeoCode()
  geocoder.getLocations(address, getGeoCode);  
   }

   function getGeoCode(response)
   {
  // Retrieve the object
  place = response.Placemark[0];

  // Retrieve the latitude and longitude
  point = new GLatLng(place.Point.coordinates[1],
        place.Point.coordinates[0]);

  $('#id_listing').append(response.name + point + '<br>');    

  // I would like to update the record identified with "id" with points found GLatLng

  // fnWriteGeocodesToFile(response.name, id , point)  



    }
我想用GLatLng中的点更新id标识的记录, 但是,我不知道如何将id作为参数添加到getGeoCode函数中

   function fnGetEncoding(address,id)
   {
  // Create new geocoding object
  geocoder = new GClientGeocoder();

  // Retrieve location information, pass it to getGeoCode()
  geocoder.getLocations(address, getGeoCode);  
   }

   function getGeoCode(response)
   {
  // Retrieve the object
  place = response.Placemark[0];

  // Retrieve the latitude and longitude
  point = new GLatLng(place.Point.coordinates[1],
        place.Point.coordinates[0]);

  $('#id_listing').append(response.name + point + '<br>');    

  // I would like to update the record identified with "id" with points found GLatLng

  // fnWriteGeocodesToFile(response.name, id , point)  



    }

我认为,这很简单:

function fnGetEncoding(address,id)
{
  // Create new geocoding object
  geocoder = new GClientGeocoder();

  // Retrieve location information, pass it to getGeoCode()

  geocoder.getLocations(address,
  **function(response,id){**
   getGeoCode(response,id);  
  **}**
}

function getGeoCode(response,id)
{
  // Retrieve the object
  place = response.Placemark[0];

  // Retrieve the latitude and longitude
  point = new GLatLng(place.Point.coordinates[1],
    place.Point.coordinates[0]);

  $('#id_listing').append(response.name + point + '<br>');    

  // I would like to update the record identified with "id" with points found GLatLng

  // fnWriteGeocodesToFile(response.name, id , point)  

}

也许你应该在问新问题之前接受你以前的问题?