Merge pull request #4190 from yuxiaoy1/docs

Improve code example of api & jQuery docs
This commit is contained in:
David Lord 2021-08-05 16:55:51 -07:00 committed by GitHub
commit a0afb6f375
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View file

@ -256,7 +256,7 @@ the filter to render data inside ``<script>`` tags.
.. sourcecode:: html+jinja
<script type=text/javascript>
<script>
const names = {{ names|tosjon }};
renderChart(names, {{ axis_data|tojson }});
</script>

View file

@ -23,8 +23,7 @@ to add a script statement to the bottom of your ``<body>`` to load jQuery:
.. sourcecode:: html
<script type=text/javascript src="{{
url_for('static', filename='jquery.js') }}"></script>
<script src="{{ url_for('static', filename='jquery.js') }}"></script>
Another method is using Google's `AJAX Libraries API
<https://developers.google.com/speed/libraries/>`_ to load jQuery:
@ -59,7 +58,7 @@ like this:
.. sourcecode:: html+jinja
<script type=text/javascript>
<script>
$SCRIPT_ROOT = {{ request.script_root|tojson }};
</script>
@ -109,7 +108,7 @@ usually a better idea to have that in a separate script file:
.. sourcecode:: html
<script type=text/javascript>
<script>
$(function() {
$('a#calculate').bind('click', function() {
$.getJSON($SCRIPT_ROOT + '/_add_numbers', {