我已经试着让它发挥作用已经有一段时间了:
{% for record in records %}
var GPSlocation = "(37.7699298, -93.4469157)";
var LatLng = GPSlocation.replace("(", "").replace(")", "").split(", ")
var Lat = parseFloat(LatLng[0]);
var Lng = parseFloat(LatLng[1]);
var markerLatlng = new google.maps.LatLng(Lat, Lng);
var marker = new google.maps.Marker({
position: record.GPSlocation,
title: record.title
});
//add the marker to the map
marker.setMap(map);
{% endfor %}
当我在里面硬编码变量时,它工作得很好,否则我什么都不会做。当我把它们用html打印出来时,我把我想要的所有数据都放在记录变量中,但是当我试图在JavaScript中使用它时,它就不起作用了。有什么想法吗?在
因此,我需要在Jinja2系统上添加一个JSON编码过滤器,我猜应该是这样的:
^{pr2}$
是的,但不是那样的。你可以这样做:
相关问题 更多 >
编程相关推荐