Hi all,
I am using a button widget in my page, where on click of the button, it calls click method in the javascript file -jsfile1.
Inside the click method in jsfile1, I would want to call a function from another javascript file -jsfile2.
For including another js file I am using the getSscript() method in jQuery, but using this, I am not able to load jsfile2.
Can somebody please let me know how we can use getScript here?
Note: I have placed jsfile1 and jsfile2 in same directory
Please find the code snippet below
jsfile1:
$(‘#’ + this.id + ‘ button’).click(
function()
{
$(‘#’ + this.id + ‘ button’).getScript(‘jsfile2.js’, function(){
alert(“Script loaded and executed.”); });
});
jsfile2:
function obj()
{
var str =”file2″;
return str;
}