python - How to set javascript variable to flask template variable using javascript -


i want set javascript variable value flask template variable in javascript. trying

$(document).on("click", ".prepopulate", function () {  var mybookid = $(this).data('id');  alert(mybookid); // value showing proper  {% set tempvar = 'mybookid' %}  alert ({{tempvar}})  });     

but it's giving error instead (undefinederror: 'list object' has no attribute 'mybookid'). way set template variable in javascript using javascript variable?

you want use set this:

%set{"tempvar" value="mybookid"}% 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -