【Titanium】 WebViewを用いて値をPOSTする
2014/04/08 09:17:28(火曜日)
Ti.Network.createHTTPClient()を使用して値をPOSTし、返答されたhtmlをwebviewに入れ込む。
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var webview = Ti.UI.createWebView();
win1.add(webview);
var xhr = Ti.Network.createHTTPClient();
xhr.open('POST', 'http://www.snee.com/xml/crud/posttest.cgi');
xhr.onload = function () {
webview.html = this.responseText;
};
xhr.send({
fname: 'value',
lname: 'value_two'
});
win1.open();
参考:http://developer.appcelerator.com/question/121380/post-variable-to-webview