Skip to content
Myr

Improving documentation for loading jQuery. Now using Google CDN with fallback to local jQuery.

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

authored by Peter Manser · committed by Peter Manser · parent 65f9bc7 · Browse files · 1 file+7 added−7 removed
This commit

State

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

Diff stats

1 file+7 added−7 removed

  • other:+7 added−7 removed

1 file+7 added−7 removed

modified:docs/patterns/jquery.rst+7 added-7 removed
21 unmodified lines
2223In order to use jQuery, you have to download it first and place it in the24static folder of your application and then ensure it's loaded. Ideally25you have a layout template that is used for all pages where you just have26to add a script statement to your `head` to load jQuery:26to add a script statement to the bottom of your `<body>` to load jQuery:2728.. sourcecode:: html2930 <script type=text/javascript src="{{
3 unmodified lines
34<http://code.google.com/apis/ajaxlibs/documentation/>`_ to load jQuery:3536.. sourcecode:: html3738 <script type=text/javascript39 src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>38 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js"></script>39 <script>window.jQuery || document.write('<script src="{{40 url_for('static', filename='jquery.js') }}">\x3C/script>')</script>4141In this case you don't have to put jQuery into your static folder, it will42instead be loaded from Google directly. This has the advantage that your42In this case you have to put jQuery into your static folder as a fallback, but it will43first try to load it directly from Google. This has the advantage that your44website will probably load faster for users if they went to at least one45other website before using the same jQuery version from Google because it45will already be in the browser cache. Downside is that if you don't have46network connectivity during development jQuery will not load.46will already be in the browser cache.4748Where is My Site?49-----------------50
117 unmodified lines