JavaScript file not loaded when navigating from index page to sub page
Lukas Schörghuber <[email protected]>
| Newsgroups | gmane.comp.python.cherrypy |
|---|---|
| Message-ID | <[email protected]> |
Hi again,
I am facing the issue that my additional page specific JavaScript file is
not loaded when I navigate from my index page to a sub page via links. For
instance when I navigate from */* to */customerAnalysisSearch* the jQuery
and jQuery Mobile JavaScript files defined in the base template are loaded,
but my page specific file is not loaded. However, when I directly enter the
URL of the sub page the JavaScript file is loaded. As already mentioned, I
am using jQuery Mobile and the Mako template engine. Below you can see my
two Mako templates, whereat the first one is the general template defining
the page layout and the second one defines the sub page
*/customerAnalysisSearch*.
*base.html*
<!DOCTYPE html>
<html>
<head>
<title>${title}</title>
<link type="text/css" rel="stylesheet"
href="/static/css/jQueryMobile_1_4_5.css"/>
<link type="text/css" rel="stylesheet"
href="/static/css/index.css"/>
</head>
<body>
<div data-role="page">
<div data-role="header" data-position="fixed">
<h1>${title}</h1>
</div>
<div data-role="main">
<%block name="content"/>
</div>
<div data-role="footer" data-position="fixed">
<p>© 2016 HAFNERTEC Bicker GmbH</p>
</div>
</div>
<script type="text/javascript"
src="/static/js/jQuery_2_1_4_min.js"></script>
<script type="text/javascript"
src="/static/js/jQueryMobile_1_4_5.js"></script>
<%block name="scripts"/>
</body>
</html>
*customerAnalysisSearch.html*
<%inherit file="base.html"/>
<%block name="content">
<div>
<form id="fCustomerSearch">
<div class="ui-field-contain">
<label for="txtCustomerSearch">Name</label>
<input type="text" data-type="search"
id="txtCustomerSearch" name="customerName"/>
</div>
<ul data-role="listview" data-filter="true"
data-filter-reveal="true" data-input="#txtCustomerSearch"
id="lvCustomerNameSuggestions"></ul>
<input type="submit" value="Suchen" data-role="button"/>
</form>
</div>
</%block>
<%block name="scripts">
*<!--this script is not loaded-->*
<script type="text/javascript"
src="/static/js/customerAnalysisSearch.js"></script>
</%block>
Thanks for your help!
--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.