I've been looking at the jquery website but I don't think I'm quite understanding this as I'm not seeing any console.logs
$(document).ready(function(){
var a=[1,2,3];
var b='foo';
var c={'bar':'baz'};
$.getScript('script.js',function(a,b,c){
console.log('how can i see a='+a+', b='+b+' and c='+c+' inside here?');
});
});
The script is executed in the global context , so simply don't pass arguments (they're shadowing those defined by the script) :
$.getScript('script.js',function(){
// use a, b and c here
console.log(a);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.