I have a section on a webapp where the user can search a map for a set of locations and it all works properly but I want the text of the location to show up in the URL so that the user can copy it and share it and it will be the same search.
What is the best way to do this and can I do it with HTML or do I need to use Javascript? I am using jinja2 as a templating engine and I am doing the back end in Python but that shouldn’t have a big impact on this. Basically I want them to be able to search for “New York City, NYC” and I want it to show up in the URL as something like
www.url.com/map?location=new%20york%20city%20nyc
The simplest way is just to create a form:
When you enter a search term into the input box and hit “Submit” the browser will make a request to
http://www.your-site.com/?q=Your%20Search%20Term– and then you can get the argument fromrequestand do whatever you need to do with it.