【发布时间】:2015-03-05 11:15:35
【问题描述】:
我正在使用 webapp2、python 与 GAE 合作。 现在我正在使用 gae 在谷歌地图上工作。已在多个位置成功完成。
This is my JavaScript:
======================
<script type="text/javascript">
var USER_POSITION;
var DESTINATION_MARKER;
var ALL_MARKERS = [];
var coordinateArray = [
{coordinates: new google.maps.LatLng(12.9345494,77.6115174), id: "forum", title: "Forum", address_details: Bengaluru<br/>Karnataka-560095"},
{coordinates: new google.maps.LatLng(12.973584,77.611293), id: "central", title: "Central", address_details: Bengaluru<br/>Karnataka-560001"},
{coordinates: new google.maps.LatLng(12.956534,77.701239), id: "busstop", title: "Marathahalli", address_details: Bengaluru<br/>Karnataka-560037"}
];
</script>
这里使用的是硬编码值。但我需要传递我的数据存储值。 我如何将这些数据存储值传递给我的 javascript。
This is my DBModel:
====================
class MapModel(db.Model):
Lattitude=db.StringProperty()
Landitude=db.StringProperty()
Id=db.StringProperty()
Title=db.StringProperty()
Address=db.StringProperty()
请提供一些示例代码。
我的.js:
var mapProperty = new google.maps.Map(document.getElementById("example"), myOptions);
for(var i in coordinateArray ) {
var id = coordinateArray[i]['id'];
var title = coordinateArray[i]['title'];
var position = coordinateArray[i]['coordinates'];
var address_details = coordinateArray[i]['address_details'];
var boxText = [
'<div class="info_box">',
..info details..
'</div>'
].join(" ");
var markerOptions = {
animation: markerAnimation,
position: coordinateArray[i]['coordinates'],
icon: markerImage,
map: mapProperty,
html: boxText,
id: id
};
【问题讨论】:
-
您可以在页面呈现时发送它们,或者您可以让页面通过例如请求它们一个ajax请求
-
嗨 Paul Collingwood 正在使用 javascript 请求。我添加了我的 My.js 代码。请检查。
-
我不确定您的意思 - 它要么有效,要么无效,如果无效,那么问题是什么?我无法检查它,因为我不知道它应该 做什么。无论如何,这些天我正在使用 Dart :)
标签: javascript twitter-bootstrap google-app-engine google-cloud-datastore