Hello... I am using this code to load and pass data to js file
jQuery.ajax({
async: true,
type: "GET",
url: "js/test.js",
data:({data : result}),
success: function() {},
dataType: 'script' });
and in the the test.js i have this
alert(result);
but alert is not working and it does not throw any error... test.js file cannot recognize parameter passed... I know this is easy if i have a php file but what about js?
I am using firebug, result variable is defined.. Lets say i pass a string "hello" as parameter
data:{data : 'hello'},
firebug shows this : http://localhost/js/test.js?data=hello
but still alert(data);
in the test.js does not work
The general Question is: How to read a parameter passed in a js file?