I know that the standard way to do this is to create a script tag with a global JS variable in your Django template before you import your other JS files but that won't work for my current situation.
I have an article detail view which is a single model instance. But I also have a list of comment objects that have a Foreign Key to the article (because that is the article that is being commented on). I need to pass the comment_id to the JS files that I am loading. If you want to see the code I am using then you can see it here: https://gitlab.com/glamorous-systems/seductive/blob/master/blog/templates/blog/article_detail.html I thought I'd use an onclick event on the Like / Dislike button to call a JS function which then passes that value to this JS file: https://gitlab.com/glamorous-systems/seductive/blob/master/blog/static/js/pass_comment_id.js and then I'd just call the return_comment_id() function from my other JS files to get the comment_id of the specific comment the user clicked the Like / Dislike button for. I think the problem is that my jQuery AJAX selectors are also looking for a click event, so they happen in a strange order, but I'm not sure. I'm totally lost on what I should be doing here. Any help would be very much appreciated :). -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADNsu1OksTqc2crvX%3DK%3D_Kf_Xz1fCfABTRV-q48htRUikiAtXA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

