【发布时间】:2019-01-22 21:07:18
【问题描述】:
首先,我是 Stack Overflow 和 jQuery 的新手,很抱歉我的错误。 我试图在我的网站上制作一个简单的实时谷歌地图标记,以每 1 秒重新加载一个 id,它们是谷歌地图的纬度、经度。但是当我尝试 JavaScript 时,它说无效值。我试图发出警报,但一切看起来都很好。
错误看起来像这样
InvalidValueError: setPosition: not a LatLng or LatLngLiteral: not an Object
function moveMarker( map, marker ) {
setInterval( function() {
//Reload new lat long to id
$("#container12").load(" #container1");
//Load data from id
var uluru = document.getElementById("container1");
//Filter for all HTML and put only Lat, Long
textContent = uluru.textContent;
//put the Marker to google map
var marker = new google.maps.Marker({position: textContent, map: map});
//test if data ar loaded fine or loock eveything ok like "11.12, 13.14"
alert(textContent);
//Run this every second
}, 1000 );
};
【问题讨论】:
标签: javascript jquery html google-maps real-time