mirror of https://github.com/mitsuhiko/flask.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
666 B
28 lines
666 B
7 years ago
|
{% extends 'base.html' %}
|
||
|
|
||
|
{% block intro %}
|
||
|
<a href="https://jquery.com/">jQuery</a> is a popular library that
|
||
|
adds cross browser APIs for common tasks. However, it requires loading
|
||
|
an extra library.
|
||
|
{% endblock %}
|
||
|
|
||
|
{% block script %}
|
||
|
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
|
||
|
<script>
|
||
|
function addSubmit(ev) {
|
||
|
ev.preventDefault();
|
||
|
$.ajax({
|
||
|
method: 'POST',
|
||
|
url: '{{ url_for('add') }}',
|
||
|
data: $(this).serialize()
|
||
|
}).done(addShow);
|
||
|
}
|
||
|
|
||
|
function addShow(data) {
|
||
|
$('#result').text(data.result);
|
||
|
}
|
||
|
|
||
|
$('form:first').on('submit', addSubmit);
|
||
|
</script>
|
||
|
{% endblock %}
|