May-02-2020, 08:16 AM
(This post was last modified: May-02-2020, 08:16 AM by experimental.)
i need to dynamically generate parameters for url after clicking on <a href> link. having jinja code like this:
{% for i in data %} <a href='{{url_for("play", artist="???", album="???", title="???" )}}' onclick='clickfunc(link)'>{{ i }}</a> <br> {% endfor %}how do i pass javascript variables for artist, album, title (on the place where are the question marks). this is my js function
function clickfunc(link) { var t = link.innerText || link.textContent; var splitted = t.split(" - ") artist = splitted[0] album = splitted[1] title = splitted[2] return [artist, album, title]; }is there a way to do it? so far i havent found any answer that would help