remove javascript fetch polyfill

This commit is contained in:
David Lord 2022-02-14 10:33:25 -08:00
parent c7f2ab8e7a
commit 6f6e3289da
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
7 changed files with 22 additions and 24 deletions

View file

@ -1,28 +0,0 @@
{% extends 'base.html' %}
{% block intro %}
<a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest"><code>XMLHttpRequest</code></a>
is the plain JavaScript way to make requests. It's natively supported
by all browsers.
{% endblock %}
{% block script %}
<script>
function addSubmit(ev) {
ev.preventDefault();
var request = new XMLHttpRequest();
request.addEventListener('load', addShow);
request.open('POST', {{ url_for('add')|tojson }});
request.send(new FormData(this));
}
function addShow() {
var data = JSON.parse(this.responseText);
var span = document.getElementById('result');
span.innerText = data.result;
}
var form = document.getElementById('calc');
form.addEventListener('submit', addSubmit);
</script>
{% endblock %}