Home / File/ fetch.html — flask Source File

fetch.html — flask Source File

Architecture documentation for fetch.html, a html file in the flask codebase.

Entity Profile

Source Code

{% extends 'base.html' %}

{% block intro %}
  <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch"><code>fetch</code></a>
  is the <em>modern</em> plain JavaScript way to make requests. It's
  supported in all modern browsers.
{% endblock %}

{% block script %}
  <script>
    function addSubmit(ev) {
      ev.preventDefault();
      fetch({{ url_for('add')|tojson }}, {
        method: 'POST',
        body: new FormData(this)
      })
        .then(parseJSON)
        .then(addShow);
    }

    function parseJSON(response) {
      return response.json();
    }

    function addShow(data) {
      var span = document.getElementById('result');
      span.innerText = data.result;
    }

    var form = document.getElementById('calc');
    form.addEventListener('submit', addSubmit);
  </script>
{% endblock %}

Frequently Asked Questions

What does fetch.html do?
fetch.html is a source file in the flask codebase, written in html.
Where is fetch.html in the architecture?
fetch.html is located at examples/javascript/js_example/templates/fetch.html (directory: examples/javascript/js_example/templates).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free