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>
Ajit Medhekar
  • 1,018
  • 1
  • 10
  • 39
Googles
  • 25
  • 6

1 Answers1

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.

Nayana_Das
  • 1,789
  • 4
  • 23
  • 48
  • @Googles : Are you trying to use this https://github.com/requirejs/example-jquery-cdn or this http://stackoverflow.com/questions/4535926/how-do-i-use-requirejs-and-jquery-together – Nayana_Das Mar 22 '16 at 11:23
  • 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"]);` – Googles Mar 22 '16 at 11:30
  • At where? Index.html or main.min.js? You can try [link](http://northapp.co). And i hope you can using jquery. Thats without jquery – Googles Mar 22 '16 at 11:38
  • yes, you can use it inside index.html, the path set for baseURl, has to be there. – Nayana_Das Mar 22 '16 at 11:42
  • In your code the path used is "_a/js", so use the same to set for "baseUrl" – Nayana_Das Mar 22 '16 at 11:45
  • Thats code insert in index.html? You cAn see this, cause that code insert in app.js [link](https://github.com/requirejs/example-jquery-cdn/blob/master/www/js/app.js) – Googles Mar 22 '16 at 12:17