I know that my question is so similar to this one, but I have the same problem and none of the solutions work for me.
My directory structure is the following:
static
lib
require.js
jquery-1.11.3.js
progressbar.js
client
client.messages.js
client.js
main.js
config.js
My HTML file is like this:
<script src="{{ url_for('static', filename='scripts/lib/require.js') }}"></script>
<script>
var require = {
baseUrl: "/static/script",
paths: {
/* Load common libraries from CDN and fallback to local versions. */
"jquery": "lib/jquery-1.11.3.min.js",
"progressbar": "lib/progressbar.min.js",
"messages": "client/client.messages.js"
}
};
</script>
<script src="{{ url_for('static', filename='scripts/main.js') }}"></script>
I have also tried to make the configuration in the config.js file which was like:
var require = {
baseUrl: "/static/script",
paths: {
/* Load common libraries from CDN and fallback to local versions. */
"jquery": "lib/jquery-1.11.3.min.js",
"progressbar": "lib/progressbar.min.js",
"messages": "client/client.messages.js"
}
};
and then the HTML file was like:
<script src="{{ url_for('static', filename='scripts/config.js') }}"></script>
<script src="{{ url_for('static', filename='scripts/lib/require.js') }}"></script>
<script src="{{ url_for('static', filename='scripts/main.js') }}"></script>
Further down in my HTML file there is this line:
<body onload="bodyLoaded()">
and this bodyLoaded() function is in my main.js:
var bodyLoaded = function () {
//load scripts first
var scripts = ['static/scripts/client/client.messages.js', 'static/scripts/client/client.js'];
$.getScript(scripts[0], function () {
$.getScript(scripts[1], function () {
pluginCheck();
});
});
};
The error I get is:
Uncaught ReferenceError: $ is not defined
for this line in bodyload():
$.getScript(scripts[0], function () {
Am I missing something?
$forjQuery?$.getScript(...tojQuery.getScript(...