Question

I'm getting an unknown error where the loginConnect.onload should run.

I was following an older tutorial located at http://code.tutsplus.com/tutorials/titanium-user-authentication-part-1--mobile-3728

Any help would be appreciated! thank you!

  var loginConnect = Titanium.Network.createHTTPClient();


    function gridWindow(e){
    if($.username.value != ""&&$.password.value != ""){

loginConnect.open("POST","http://localhost:80/grid/indexgrid.php");

var params = {
        username: $.username.value,
        password: Ti.Utils.md5HexDigest($.password.value)
   };
    loginConnect.send(params);

        }   else{
alert('All fields are required');
 }
 };

loginConnect.onload = function()
{
var json = this.responseText;
var response = JSON.parse(json);
if (response.logged == true)
{
    alert("Welcome back");

} else {
    alert('not working');
      }
  };

   $.index.open();
Was it helpful?

Solution

Try this...

loginConnect.send(JSON.stringify(params));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top