url_for and jquery/javascript
Ok I am at my wits end. I am trying to add a url parameter to url_for.
I know it works, because when I hardcode the id goes to the page. Where I am having trouble is the jquery/javascript part. I don't know the correct combo.
$("#show_link").append("<tr><td><a href='{{ url_for('site.doc',id=5) }}' id='"+id+"'>"+id+"</a><td></td><td>"+name+"</td><td>"+name2+"</td></tr>");
The above works, because the id is hard coded.
when I try to add the javascript id it does not work. It prints out
id=+id+
Here is one of the combo's I have tried.
$("#show_link").append("<tr><td><a href='{{ url_for('site.doc',id='"+id+"') }}' id='"+id+"'>"+id+"</a><td></td><td>"+name+"</td><td>"+name2+"</td></tr>");
Yes id does have a value associated with it.
/r/flask
https://redd.it/6di61d
Ok I am at my wits end. I am trying to add a url parameter to url_for.
I know it works, because when I hardcode the id goes to the page. Where I am having trouble is the jquery/javascript part. I don't know the correct combo.
$("#show_link").append("<tr><td><a href='{{ url_for('site.doc',id=5) }}' id='"+id+"'>"+id+"</a><td></td><td>"+name+"</td><td>"+name2+"</td></tr>");
The above works, because the id is hard coded.
when I try to add the javascript id it does not work. It prints out
id=+id+
Here is one of the combo's I have tried.
$("#show_link").append("<tr><td><a href='{{ url_for('site.doc',id='"+id+"') }}' id='"+id+"'>"+id+"</a><td></td><td>"+name+"</td><td>"+name2+"</td></tr>");
Yes id does have a value associated with it.
/r/flask
https://redd.it/6di61d
reddit
url_for and jquery/javascript • r/flask
Ok I am at my wits end. I am trying to add a url parameter to url_for. I know it works, because when I hardcode the id goes to the page. Where I...