In jQuery, how do I call a function in a script that I retrieve via code?
I have a javascript file called testjavascript.js
Here is the code:
function testfunctionwithdata(testdata)
{
alert(testdata);
}
function testfunction()
{
alert("testfunction");
}
I also have a javascript called testcalljavascriptfunction.js
Here is the code:
var scripturl = "/objects/testjavascript.js";
$.getScript(scripturl, function() {
script.testfunction();
});
When I load the testcalljavascriptfunction.jsscript from an index.html page, I am getting the following error in the console:
Uncaught ReferenceError: script is not defined