3gwebtrain
3gwebtrain

Reputation: 15303

Require.js: "file not loading" in AMD process

I use the Require.js "AMN" to load my files, this is my HTML file.

<script data-main="js/main.js" href="js/require.js"></script>

when i load my main.js - i made this config to load my jquery file.

require.config({
    baseUrl: 'js',
    paths: {
        "jQuery":'lib/jquery-1.9.1.min'
    }
});

require(['jQuery'], function ($) {
    console.log($);
})

But i am not getting any console. all my paths are correct.my js folder's structure

my index.html file located at the parent of the js filder.

Help me to resolve this.

Upvotes: 0

Views: 98

Answers (1)

Tomas Kirda
Tomas Kirda

Reputation: 8413

jQuery module for AMD should always be lowercase. Check what path is used when browser requesting files using developer tools in chrome or fiddler. This way you will know if you configured it right.

UPDATE: please correct the syntax for loading script. Must be src instead of href.

<script data-main="js/main.js" src="js/require.js"></script>

Upvotes: 2

Related Questions