Click here to Skip to main content
15,917,061 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I just started using jquery lately & developed a small application. However the pagesize was increasing because of a lot of javascript code so I am starting to move the code in separate script files. However,

1) I cannot access other jquery plugins functions when I move my code to separate js file because they are located in other script files. How do I use the other libraries in my separate script file ?

2) Am I doing it the wrong way ? This does not work at all in my separate script file (foo.js). It says stringify is not a function

<script src="../assets/scripts/jquery.json-2.2.min.js" type="text/javascript">

    JSON.stringify('test message');

sounds to me like your external script isn't being referenced correctly. if your example is in the root of your application I'd guess your path isn't going to be:

<script src="../assets/scripts/jquery.json-2.2.min.js" type="text/javascript">

but more likely this:

<script src="assets/scripts/jquery.json-2.2.min.js" type="text/javascript">

but I can't be 100% sure without further information.
Share this answer
First of all check the file path respect to your browsing directory, use firebug to see reference file actually being loaded or not and finally use this code at top of the js file to add reference
/// <reference path="../assets/scripts/jquery.json-2.2.min.js" />

follow the discussion below[^]

hope this will help.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900