在地理编码后更新变量

时间:2013-04-02 21:49:39

标签: javascript google-maps

将地址转换为lat long之后,我想用更新的值进行ajax调用,但我无法理解。

var start = document.getElementById("src").value;
      mygc.geocode({'address': start}, function(results, status){
      var startupdate = results[0].geometry.location.lat()+","+results[0].geometry.location.lng();
      });

      end = document.getElementById("dst").value;
      mygc.geocode({'address': end}, function(results, status){
      var endupdate = results[0].geometry.location.lat()+","+results[0].geometry.location.lng();
      })

        $.ajax({
        type: 'GET',
        url: "http://example.com/src="+startupdate+"&dst="+endupdate,

0 个答案:

没有答案