【问题标题】:How to pass the Current Position to the EJS template如何将当前位置传递给 EJS 模板
【发布时间】:2020-10-07 13:13:36
【问题描述】:

我正在使用 EJS,并且有一个指向谷歌地图的链接,我需要在其中获取原点的当前用户位置,而目的地是从数据库中获取的。我不知道如何将此原始变量传递给链接。我尝试了以下方法,但当然,服务器端的用户位置不可用。关于如何将位置动态传递给链接的任何线索?

<a href='https://www.google.com/maps/dir/?api=1
&origin=
<%=userLatitude%>,
<%=userLongitude%>
&destination=
<%=destination.latitude%>, 
<%=destination.longitude%>
&travelmode=driving'
target="_blank">Ir </a>

【问题讨论】:

    标签: javascript html node.js ejs template-engine


    【解决方案1】:

    在渲染后用JS简单地编辑链接找到了解决方案。

    【讨论】:

      猜你喜欢
      • 2016-12-13
      • 1970-01-01
      • 2014-08-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多