Google地图信息窗口 - 使用JavaScript更改我的位置 - Asp.NET

时间:2018-06-14 12:16:59

标签: asp.net google-maps button onclick infowindow

我在保存会话后尝试将我的网页重定向到我的asp.net项目的另一条路径,代码在这里:

(function (marker, data) {
    google.maps.event.addListener(marker, "click", function (e) {
        infoWindow.setContent('<div class="card" style ="width:200px;height:auto;">' +
        '<img class="card-img-top" src='+data.photo+' style="width:200px;height:auto;" >' +
        '<div class="card-body">'+
        '<h5 class="card-title">' + data.title + '</h5>' +
        '<p class="card-text">' + data.description + '</p>' +
        '<button id="btn_seedetails" >Click me</button>' +
        '</div>' + 
        '</div >' );
        infoWindow.open(map, marker);
        google.maps.event.addDomListener(document.getElementById('btn_seedetails'), 'click', sendit);                                           
   });

   function sendit() {
       '<%Session["ID_EVENT"] = "' + data.id + '"; %>';
       document.location.href = "AllConflicts.aspx";
       location.replace("AllConflicts.aspx")
   }
})(marker, data);

1 个答案:

答案 0 :(得分:0)

也许使用查询字符串传递数据:

function sendit() {
    window.location.href("AllConflicts.aspx?id=" + data.id);
}

也是JS How do I redirect to another webpage?

中重定向的好参考

也许data.id在函数中不可用。您可能希望使用sendit函数的输入参数。

相关问题