Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
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