【发布时间】:2018-02-09 18:24:23
【问题描述】:
我想从 JS 中导出搜索结果变量(纬度和经度)作为 php 变量。 我知道必须有另一个 php 文件,例如 test.php。
以下变量:
marker.setPlace({
placeId: place.place_id,
location: results[0].geometry.location,
});
marker.setVisible(true);
//infowindowContent.children['place-name'].textContent = place.name;
//infowindowContent.children['place-id'].textContent = place.place_id;
infowindowContent.children['place-address'].textContent =
//results[0].formatted_address;
results[0].geometry.location.lat(),
results[0].geometry.location.lng(),
infowindow.open(map, marker);
});
});
}
【问题讨论】:
-
您需要在 PHP 中创建 HTTP 端点,然后您可以将 lat lon 传递给 url 或者可以设置为 cookie 并从 PHP 中读取它
标签: javascript php ajax google-maps-api-3