Guest User

Untitled

a guest
Dec 13th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script src="jquery-3.2.1.min.js"></script>
  4. </head>
  5. ...
  6. <form>
  7. {% csrf_token %}
  8. <input type="hidden" id="tk">
  9. ...
  10. <button type="button" id="download-button">Download</button>
  11. </form>
  12. <script>
  13. $('#download-button').click(function(){
  14. $("#tk").val($("[name='csrfmiddlewaretoken']").val());
  15. $("form").submit();
  16. });
  17. $(window).focus(function(){
  18. if($("#tk").val() == $("[name='csrfmiddlewaretoken']").val()){
  19. location.reload();
  20. }
  21. });
  22. </script>
  23. </html>
Add Comment
Please, Sign In to add comment