박성우
박성우

Reputation: 21

How to connect between HTML button and python(or flask) function?

In flask programming, people usually use 'url_for' such as {{url_for = 'some url'}} This way have to make URL(@app.route), template(HTML) and map each other.

But, I just want to send email when I click submit button in HTML modal. For this, There is no page reloading. To do this, I think I have to connect between button and python function without URL, return(response)

I wonder that how to make it, help me please, I'm beginner in flask programming.

Upvotes: 0

Views: 1397

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599590

You can't trigger anything on the server without making a request to a URL.

If you don't want the page to reload, you can either redirect back to the original page after your action is finished, or you can use Ajax to make the request without changing the page; but the request itself is always to a URL.

Upvotes: 2

Related Questions