开发者

Unable to send GET request from Titanium Studio (Android Emulator)

I am new in this field. I am working on Android application development. I am using Titanium studio for development. Currently I am working on log in component. I am using following code:

var win = Titanium.UI.currentWindow;

var username = Titanium.UI.createTextField({
color:'#336699',
top:10,
left:10,
width:300,
height:40,
hintText:'Username',
keyboardType:Titanium.UI.KEYBOARD_DEFAULT,
returnKeyType:Titanium.UI.RETURNKEY_DEFAULT,
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
win.add(username);

var password = Titanium.UI.createTextField({
color:'#336699',
top:60,
left:10,
width:300,
height:40,
hintText:'Password',
passwordMask:true,
keyboardType:Titanium.UI.KEYBOARD_DEFAULT,
returnKeyType:Titanium.UI.RETURNKEY_DEFAULT,
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
win.add(password);

var loginBtn = Titanium.UI.createButton({
title:'Login',
top:110,
width:90,
height:35,
borderRadius:1,
font:{fontFamily:'Arial',fontWeight:'bold',fontSize:14}
 });
win.add(loginBtn);

var loginReq = Titanium.Network.createHTTPClient();
loginBtn.addEventListener('click',function(e)
{
    if (username.value != '' && password.value != '')
{
    loginReq.open("GET","http://localhost:3000");
}
else
{
    alert("Username/Password are required");
}
});
 

But it's not wo开发者_开发问答rking and not sending GET request.


Call send() on your HTTPClient

loginReq.open("GET","http://localhost:3000");
loginReq.send();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜