How to pass parameters from one .js file to another?
Hi Friends,
I am very happy that all my questions are answered swiftly. I have a doubt regarding passing parameters from one js to another.
That is, when I create a new window from a js to and open that window, I wanted some data to be passed on to the other js. In objective C, when I create a new ViewCOntroller, I write a custom init function , with which I get the data to intialize the ViewCOntroller. But how can I do here?
1 Answer
-
Accepted Answer
something like this should do it.
var variableToSend = 'hello!'; var newWin = Ti.UI.createWindow({url:'window.js'}); newWin.variableReceived = variableToSend; newWin.open();
and then in 'window.js'
var win = Ti.UI.currentWindow; Ti.API.info(win.variableReceived);
should print 'hello!' in the console when the new window opens :)