Hi all,
My colleagues and my friends are asked me how do i declare static variables in java script and then how to access those variable whenever i want into my java script. The below i mentioned some example that will surely helpful to you. This question also helpful to how to include javascript in .js files
How to import java script file into .js file
var baseurl = "http://site4developer.blogspot.com";
}
to call this
var ur = globalVariable();
alert(ur);
where ever u want
My colleagues and my friends are asked me how do i declare static variables in java script and then how to access those variable whenever i want into my java script. The below i mentioned some example that will surely helpful to you. This question also helpful to how to include javascript in .js files
How to import java script file into .js file
If you want to include a JS file in a JS you can use jQuery for that
$.getScript('another_file.js', function() {
//script is loaded and executed put your dependent JS here
});
And if you cannot use jQuery
var imported = document.createElement('script');
imported.src = '/path/to/imported/script';
document.head.appendChild(imported);
function globalVariable(){
var baseurl = "http://site4developer.blogspot.com";
}
to call this
var ur = globalVariable();
alert(ur);
where ever u want
0 comments:
Post a Comment