Skip to content
Myr

Merge pull request #4190 from yuxiaoy1/docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Improve code example of api & jQuery docs

authored by David Lord · committed by GitHub · parents 5dfa67e, 29c09a9 · Browse files · 2 files+4 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+4 added−5 removed

  • other:+4 added−5 removed

2 files+4 added−5 removed

modified:docs/patterns/jquery.rst+3 added-4 removed
21 unmodified lines
22to add a script statement to the bottom of your ``<body>`` to load jQuery:2324.. sourcecode:: html2526 <script type=text/javascript src="{{27 url_for('static', filename='jquery.js') }}"></script>26 <script src="{{ url_for('static', filename='jquery.js') }}"></script>2728Another method is using Google's `AJAX Libraries API29<https://developers.google.com/speed/libraries/>`_ to load jQuery:30
26 unmodified lines
57like this:5859.. sourcecode:: html+jinja6062 <script type=text/javascript>61 <script>62 $SCRIPT_ROOT = {{ request.script_root|tojson }};63 </script>6465
41 unmodified lines
107usually a better idea to have that in a separate script file:108109.. sourcecode:: html110112 <script type=text/javascript>111 <script>112 $(function() {113 $('a#calculate').bind('click', function() {114 $.getJSON($SCRIPT_ROOT + '/_add_numbers', {115 a: $('input[name="a"]').val(),
33 unmodified lines
modified:docs/api.rst+1 added-1 removed
254 unmodified lines
255the filter to render data inside ``<script>`` tags.256257.. sourcecode:: html+jinja258259 <script type=text/javascript>259 <script>260 const names = {{ names|tosjon }};261 renderChart(names, {{ axis_data|tojson }});262 </script>263
512 unmodified lines