Passing a data into a webview

You must Login before you can answer or comment on any questions.

Hi,

I have a button that loads form.php into a webview. I'm trying to pass a variable into the webview so that maybe the 'title' of the previous window is displayed in the php form. Can anyone tell me if this is possible? I've included the code below for the button below. Thanks very much in advance!

button.addEventListener('click',function() {
            var win = Titanium.UI.createWindow({});
                var webview = Titanium.UI.createWebView({url:'http://www.domain.com/form.php'});
 
    var close_btn = Titanium.UI.createButton({
        title:'Close'
    });
    close_button.addEventListener('click', function() {
        win.close();
    });
    win.setLeftNavButton(close_button);
        win.add(webview);   
    win.open({modal:true});
});

1 Answer

Accepted Answer

just pass it in as a parameter on the url and modify the PHP code to get the information

var webview = Titanium.UI.createWebView({
   url:'http://www.domain.com/form.php?theTitle=' +"a title"
});

Your Answer

Think you can help? Login to answer this question!