javascript - Using Jquery's .getScript is it possible to pass variables to your current script -


this question has answer here:

say have js file stores singular object. in js script need access object. can use .getscript or there way? when try use .getscript variables set outside of scope , update in getscript scope not update.

given following html:

<script type="text/javascript" src="jquery-2.0.3.min.js"></script> <script>     var external = false;     $.getscript('test.js', function(){         console.log(external);     }); </script> 

and following script in test.js:

var external = {     my:'object' }; 

the log show {my:'object'}


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -