1👍
✅
AFAIK there is no standard approach. You can:
- put JS into template and render view variable
- pass variable in JS globals, setting it’s value in template text
- parse window.location
…etc.
I personally prefer the second way, e.g. put this code in template and then use _reset_pw_code global in javascript file:
<script> var _reset_pw_code = "{{ reset_code|escapejs }}" </script>
0👍
Recently JavaScript added a new API to do this it is currently still experimental.
const pattern = new URLPattern('reset_pwd/:code/', 'https://example.com');
console.log(pattern.exec('https://example.com/reset_pwd/thECode/').pathname.groups); // { code: 'thECode' }
https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API
- [Answer]-Trying to make a Django / Mezzanine "Page last updated by on date"
- [Answer]-HttpClient POST data to RESTful API data not being read by the server
Source:stackexchange.com