hi, I am on working on a titanium app for android. from the app i am trying to connect to my localhost. But its showing an error like the connection is refused or something like that. Here I am providing my code.
var loginReq = Titanium.Network.createHTTPClient(); loginReq.onload = function() { var json = this.responseText; Ti.API.info(this.responseText) var response = JSON.parse(json); if (response.logged == true) { alert("Welcome " + response.name + ". Your email is: " + response.email); } else { alert(response.message); } }; loginReq.onerror = function() { alert("Network error"); }; //login button action loginBtn.addEventListener('click',function(e) { if (username.value != '' && password.value != '') { loginReq.open("POST","http://localhost/testapp/post_auth.php"); var params = { username: username.value, password: password.value }; loginReq.send(params); } else { alert("Username/Password are required"); } });