With the Bootstrap modal dialog's id="myModal"
:
<div id="myModal" class="modal fade" role="dialog">
...
</div>
I can call it by clicking a simple <a>
. It happens because <a>
s data-target
attribute is linked to the modal dialog's id
myModal
:
<a data-toggle="modal" data-target="#myModal">Click Here</a>
I wonder if there is a way to call this modal dialog by its id
from inside of Flask python function.
@app.route('/call_modal', methods=['GET', 'POST'])
def call_modal():
# ... call modal dialog by its id?
You can use another modal plugin to make it work, such as Remodal. Similarly as Bootstrap modal, every modal has an id, you can call it as an anchor, like this: //example.com#myModal
.
In your view.py:
@app.route('/call_modal', methods=['GET', 'POST'])
def call_modal():
redirect(url_for('index') + '#myModal')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With