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
Post a Comment