Skip to content
Myr

README.rst

This file

Path

examples/javascript/README.rst

49 lines · 1.0 KiB

Last changed by

Add prefix for all commands in documentation (#2877)Grey Libefore adoption21b0aa6

History of this file

Take it

Merge pull request #2699 from pallets/javascriptDavid Lordbefore adoption746b91d

lines 1–25why, one step back
1JavaScript Ajax Example
2=======================34Demonstrates how to post form data and process a JSON response using5JavaScript. This allows making requests without navigating away from the6page. Demonstrates using |XMLHttpRequest|_, |fetch|_, and7|jQuery.ajax|_. See the `Flask docs`_ about jQuery and Ajax.89.. |XMLHttpRequest| replace:: ``XMLHttpRequest``10.. _XMLHttpRequest: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest1112.. |fetch| replace:: ``fetch``13.. _fetch: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch1415.. |jQuery.ajax| replace:: ``jQuery.ajax``16.. _jQuery.ajax: https://api.jquery.com/jQuery.ajax/1718.. _Flask docs: http://flask.pocoo.org/docs/patterns/jquery/192021Install22-------2324::25

Add prefix for all commands in documentation (#2877)Grey Libefore adoption21b0aa6

lines 26–28why, one step back
26 $ python3 -m venv venv
27 $ . venv/bin/activate28 $ pip install -e .

Merge pull request #2699 from pallets/javascriptDavid Lordbefore adoption746b91d

lines 29–35why, one step back
29
3031Run32---3334::35

Add prefix for all commands in documentation (#2877)Grey Libefore adoption21b0aa6

lines 36–37why, one step back
36 $ export FLASK_APP=js_example
37 $ flask run

Merge pull request #2699 from pallets/javascriptDavid Lordbefore adoption746b91d

lines 38–46why, one step back
38
39Open http://127.0.0.1:5000 in a browser.404142Test43----4445::46

Add prefix for all commands in documentation (#2877)Grey Libefore adoption21b0aa6

lines 47–49why, one step back
47 $ pip install -e '.[test]'
48 $ coverage run -m pytest49 $ coverage report