[Answered ]-Save dynamic page in Django

2👍

You need your web page to send that information to your server so it can update it in the session. The way session works in django is it only sends a session id to your web page(usually through cookie) and then that cookie is sent back with every request your web page does(cookie is part of HTTP protocol and managed by the web browser).

The template code is run on the server to output html and javascript but none of this is actually run on the server and the template is not a live connection to your server. Merely setting variable in javascript will not get them back to the server.

You could however send the saved variable in a request to your server using an ajax request for example so your server puts them in the session for later use.

jQuery provides an unload event to be notified when the user goes away. You could bind to this event to do your update.

Leave a comment