Javascript 无法从Titanium Studio(Android Emulator)发送GET请求

Javascript 无法从Titanium Studio(Android Emulator)发送GET请求,javascript,dom-events,titanium,Javascript,Dom Events,Titanium,我是这个领域的新手。我正在从事Android应用程序开发。我正在使用钛工作室进行开发。目前我正在开发登录组件。我正在使用以下代码: 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

我是这个领域的新手。我正在从事Android应用程序开发。我正在使用钛工作室进行开发。目前我正在开发登录组件。我正在使用以下代码:

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");
}
});
 
但它不工作,也不发送GET请求。

在您的HTTPClient上调用send()

loginReq.open("GET","http://localhost:3000");
loginReq.send();
在HTTPClient上调用send()

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