Z
Z
zhenyabondarev2020-08-17 20:08:47
Python
zhenyabondarev, 2020-08-17 20:08:47

Why can't I run Jquery click handler in html code to run a function written in python?

When you click on the button created through, a java script should be launched, which opens my python code, which runs the data through itself and issues a text response, I run all this using the Jquery handler, but it does not work

<div >
      <div class="text">
        <p id="search">Введите ваше уравнение: </p>
      </div>
      <div class="form">
        <div class="a"><input id="a" type="number" placeholder="a"></div>
        <div class="b"><p>x<sup>2</sup>+</p></div>
        <div class="a"><input id="b" type="number" placeholder="b"></div>
        <div class="b"><p>x+</p></div>
        <div class="a"><input id="c" type="number" placeholder="c"></div>
        <div class="b"><p>=0</p></div>
      </div>
      <button id="show">Расчитать x<sub>1</sub>, x<sub>2</sub></button>
    </div>

    <div id="info">5</div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script type="text/javascript">
      async function kvd2r(){
        let place = document.getElementById('a').value;
        let place1 = document.getElementById('b').value;
        let place2 = document.getElementById('c').value;

        let res = await eel.kvdr(place,place1,place2)();
        document.getElementById('info').innerHTML = res;
      }

      jQuery('#show').on('click',function(){
        kvd2r()
      });
    </script>

The kvdr function in python takes three numeric values*
import eel
eel.init("web1")
eel.start("main.html", size=(700,700))

@eel.expose
def kvdr(a,b,c):

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kovalsky, 2020-08-17
@lazalu68

https://github.com/samuelhwilliams/Eel/tree/master...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question