Answers for "how to link javascript functions in flask"

4

html include js file flask

<script type="text/javascript"
         src="{{ url_for('static', filename='map.js') }}"></script>
Posted by: Guest on November-24-2020
0

call javascript function flask

from flask import Flask, render_template

app = Flask(__name__)


@app.route('/', methods=['GET', 'POST'])
def upload_file():
    if request.method == 'POST':
        #verify if the file is valid
        #here invoke js to do something (for example flash("test"))
        return render_template('upload.html', flash_message="True")

    return render_template('upload.html', flash_message="False")
Posted by: Guest on April-28-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language