2

I have problem with specific piece of code:

<script data-main="http://northapp.co/_a/js/main.min.js" src="http://northapp.co/_a/js/require.js"></script>

Why can not I connect require.js with jquery.min.js? I tried following code, but it is not working. Can someone help me?

<script data-main="http://northapp.co/_a/js/main.min.js" src="http://northapp.co/_a/js/require.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

1 Answer 1

1

I think you have to add it separately, just like jQuery.

<script src="http://requirejs.org/docs/release/2.2.0/minified/require.js"></script>

After adding requirejs, add the following code inside script tag

<script>
 requirejs.config({
    "baseUrl": "js/lib",
    "paths": {
    "app": "../app",
    "jquery": "//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min"
  }
});
</script>

Hope it works.

Sign up to request clarification or add additional context in comments.

6 Comments

Yes but this code idk for what and copy paste at where requirejs.config({ "baseUrl": "js/lib", "paths": { "app": "../app", "jquery": "//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min" } }); // Load the main app module to start the app requirejs(["app/main"]);
At where? Index.html or main.min.js? You can try link. And i hope you can using jquery. Thats without jquery
yes, you can use it inside index.html, the path set for baseURl, has to be there.
In your code the path used is "_a/js", so use the same to set for "baseUrl"
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.