I am new to RequireJS, and for some reason I cannot load scripts via CDN.
My code is:
// site full url var siteUrl = window.location.protocol+"//"+window.location.host + "/fresh/"; // requirejs config requirejs.config({ baseUrl: siteUrl + "assets/js/", paths: { "plugins": "plugins", "scripts": "scripts", "jquery": "https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min", "jquery-ui": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min", "bootstrap": "https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min", } }); require(['jquery', 'jquery-ui', 'bootstrap', 'plugins/chosen'], function($, chosen){ /* loading global selectors and variables */ //chosen for select boxes $(".chzn-select").chosen(); });
and jquery does not load. I get the following errors:
ReferenceError: jQuery is not defined [Megszakítás ennél a hibánál] ...h"):this.container.removeClass("chzn-container-single-nosearch")),e="",s=this.re... chosen.js (1. sor) ReferenceError: jQuery is not defined TypeError: $(...).chosen is not a function $(".chzn-select").chosen();
Can someone point out what I'm doing wrong?
PS: I am defining the website URL because I use Laravel, without this definition it includes the URLs in the base URL.
source share