我使用Javascript创建了一个地图。当我添加标记并刷新页面时,标记会消失。我尝试过使用cookie,数组和我可能知道的一切。这是我的保存功能:
function saveData(){
var incident = escape(document.getElementById("description").value);
var address = escape(document.getElementById("address").value);
var type = document.getElementById("type").value;
var latlng = marker.getLatLng();
var lat = latlng.lat();
var lng = latlng.lng();
var body = document.getElementsByTagName("body");
var bodycontent = body[0];
var url = "phpsqlinfo_addrow.php?name=" + incident + "&address=" + address +
"&type=" + type + "&lat=" + lat + "&lng=" + lng;
GDownloadUrl(url, function(data, responseCode) {
if (responseCode != 200 && data.length <= 1) {
bodycontent.innerHTML;
document.getElementById("message").innerHTML = "Longitude: " + latlng.lng() + " Latitude: " + latlng.lat()
+ " " + responseCode + " - Location added.";
document.getElementById("message").innerHTML = document.getElementById("type").value + " " + escape(document.getElementById("description").value);
document.getElementById("image").innerHTML = body[0].innerHTML;
marker.closeInfoWindow();
如何在点击时保存并保存我的标记值?