jquery.html
This file
Path
examples/javascript/js_example/templates/jquery.html
27 lines · 666 bytes · HTML
Last changed by
clean up js exampleDavid Lordbefore adoption1e84c67
History of this fileTake it
Merge pull request #2699 from pallets/javascriptDavid Lordbefore adoption746b91d
lines 1–15why, one step back1{% extends 'base.html' %}23{% block intro %}4 <a href="https://jquery.com/">jQuery</a> is a popular library that5 adds cross browser APIs for common tasks. However, it requires loading6 an extra library.7{% endblock %}89{% 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',clean up js exampleDavid Lordbefore adoption1e84c67
line 16why, one step back16 url: {{ url_for('add')|tojson }},Merge pull request #2699 from pallets/javascriptDavid Lordbefore adoption746b91d
lines 17–24why, one step back17 data: $(this).serialize()18 }).done(addShow);19 }2021 function addShow(data) {22 $('#result').text(data.result);23 }24clean up js exampleDavid Lordbefore adoption1e84c67
line 25why, one step back25 $('#calc').on('submit', addSubmit);Merge pull request #2699 from pallets/javascriptDavid Lordbefore adoption746b91d
lines 26–27why, one step back26 </script>27{% endblock %}