I am loading my script like this:
var myTestString = "/modules/admin";
$.ajax({
type: "GET",
url: "../../includes/test_tooltip.js",
data: "module="+myTestString,
dataType: "script"
});
Is it possible to have access to module variable in my test_tooltip.js like this?
I tried this as well in my main js file:
var myTestString = "/modules/admin";
$.ajax({
type: "GET",
url: "../../includes/test_tooltip.js",
data: { module: myTestString },
dataType: "script"
});
And in test_tooltip.js this:
console.log("I am loaded!" + data.module);
My scenario is like this. I sometimes need to load that javascript and when i do, i do it in different modules, and i need this javascript to know which module because he will have to do some requests based on the module.
In php i know you can acces data with $_REQUEST["module"], if it could be done in javascript similar would be great.
I am sorry for poor english.
Right now to make it work i use
window.variable
and
delete window.variable