title: How to pass a variable inside a function inside a jquery function?
body: <p>So I'm working with a google map api.
  I have to insert the values lat and lon inside of the object, but I can't do something like:</p>
  
  <pre><code>$.get(url).done(buscaGPS(data, i));
  
  function buscaGPS(data, i) {
  
  }
  </code></pre>
  
  <p>CODE</p>
  
  <pre><code>objecto = [{
      "address_1": "Avenida da Republica, 15A",
      "city": "Lisbon",
      "country": "pt",
      "id": 1534282,
      "name": "Pastelaria Versailles"
  }, {
      "address_1": "Avenida da Republica, 15A",
      "city": "Lisbon",
      "country": "pt",
      "id": 1534282,
      "name": "Pastelaria Versailles"
  }];
  
  
  for (var i = 0; i &lt; objecto.length; i++) {
      var url = "http://maps.googleapis.com/maps/api/geocode/json?address=" + objecto[i].address_1 + "+" + objecto[i].city + "+" + objecto[i].country + "&amp;sensor=false";
      $.get(url).done(buscaGPS);
  };
  
  
  
  function buscaGPS(data) {
  
      objecto[i].lat = data.results[0].geometry.location.lat;
      objecto[i].lon = data.results[0].geometry.location.lng;
  
  }
  </code></pre>