html - Unable to access javascript variable from another file -


i'm having trouble accessing globally declared javascript variable declared in separate file. code:

<script src="scripts/one.js"></script> <script src="scripts/two.js"></script> 

one.js:

var config = {     form: 'form',     validate: {         '#first-name': {             'validation': 'required',             'error-msg': 'required field'         },         // other validation rules     } }; 

two.js:

    $.validate({     modules: 'jsconf',     onmodulesloaded: function () {         $.setupvalidation(config);     } }); 

i receieve error

uncaught referenceerror: config not defined 

on load of page. reason why happening when including scripts in appropriate order?

window.yourglobalvariable 

use window.variable name variable between files.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -