Why am I getting Uncaught ReferenceError: i is not defined
in my javascript file?
So here's how I did it.
app.js
$(function() {
var i = 1;
});
some.js
$(function() {
alert(i);
});
and here's how I sequence my files.
// included jquery here
<script src="/app.js" type="javascript/text"></script>
<script src="/some.js" type="javascript/text"></script>
How can I execute or access variables from app.js
or to other javascript files? I thought they should be listed in sequence. Where did I go wrong? Any help would be much appreciated. Thanks