How to pass js variables to the flask jinja function url_for… here is a solution to the problem.
How to pass js variables to the flask jinja function url_for
< partition >
$("#getVerification").click(function () {
var tmp=$("#cellphone").val();
console.log(tmp);
$.getJSON("{{ url_for('auth.sendsms', cellphone=tmp )}}",
function(data){
});
});
As in the
above code, I want to use the string variable tmp
as a parameter in the function url_for
, but I don’t know how,
Thank you very much!