How do I access the value of key "store1" inside local storage in my Django views.py??
HTML, in Django templates --> index.html
-User will key in input and button will activate local storage function
<input type="text" id="firstID">
<button onclick="myFunction()">LocalStorage</button>
Javascript
-User input is saved in variable which is used to for local storage
var siteName = document.getElementById('firstID');
function myFunction() {
localStorage.setItem('store1', siteName.value);
LocalStorage is client storage in your browser. Your *.py
files will be executed in server. So you can not access them directly. You can save them as cookie, or put them to server via ajax request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With