I want to send data to my recommend.js function from recommend.html
words_to_highlight is an array datatype
I am initializing and passing the function from main.py using FLASK
recommend.js
function highlightText(words_to_highlight) {
console.log('button pressed');
console.log(words_to_highlight);
}
recommend.html
<button
class="display-keywords"
onclick="highlightText({{words_to_highlight}})"
>
Display keywords
</button>
main.py
@app.route("/recommend",methods=["POST"])
def recommend():
words_to_highlight = [//some_data]
.
.
.
return render_template('recommend.html',words_to_highlight=words_to_highlight)
from the html file:
onclick="highlightText({{words_to_highlight}})"
this line does not send the variable words_to_highlight to my js file as the console.log() in js prints nothing to my console