Call a python function within a html file

前端 未结 5 1035
甜味超标
甜味超标 2020-12-02 11:56

Is there a way to call a python function when a certain link is clicked within a html page?

Thanks

5条回答
  •  抹茶落季
    2020-12-02 12:06

    Yes, but not directly; you can set the onclick handler to invoke a JavaScript function that will construct an XMLHttpRequest object and send a request to a page on your server. That page on your server can, in turn, be implemented using Python and do whatever it would need to do.

提交回复
热议问题