2017-11-22 16:38

交互式地图搜索不包含永久链接 - 用JS改变的任何方式?


I've built a site that allows you to search for tattoo parlours in your local area - however, there's no way to save your search. i.e. if you search for London, the url doesn't include London in the search bar, so there's no way for people to share what they've searched with people or for me to use a callback URL to save what the person was searching if they visit another page.

Is there a way to make my map use permalinks specific to what the user is searching for?

Here's the link: Link

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • drdawt9210 drdawt9210 4年前

    If you're not averse to using a little php, an easy way would be to use PHP form handling on that search bar with something like this:

    <form action="index.php" method="post">

    That way you could end up using a field like the location to create a URL like:


    You could check to see if there is post data at all before initializing the map

        function se47439788-map(){
            if ($_POST['location']){
                $location = $_POST['location'];

    Then use the php variable $location in your script.

    <script> var location = <?php echo $location; ?>; </script>
    点赞 评论 复制链接分享