Debian Codegraph @

examples/javascript/js_example/templates/jquery.html

raw
1 {% extends 'base.html' %}
2
3 {% block intro %}
4 <a href="https://jquery.com/">jQuery</a> is a popular library that
5 adds cross browser APIs for common tasks. However, it requires loading
6 an extra library.
7 {% endblock %}
8
9 {% block script %}
10 <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
11 <script>
12 function addSubmit(ev) {
13 ev.preventDefault();
14 $.ajax({
15 method: 'POST',
16 url: {{ url_for('add')|tojson }},
17 data: $(this).serialize()
18 }).done(addShow);
19 }
20
21 function addShow(data) {
22 $('#result').text(data.result);
23 }
24
25 $('#calc').on('submit', addSubmit);
26 </script>
27 {% endblock %}