使用webapp开发的未知错误titanium json

时间:2014-05-14 01:29:36

标签: javascript json titanium

我在运行loginConnect.onload时遇到未知错误。

我正在关注位于http://code.tutsplus.com/tutorials/titanium-user-authentication-part-1--mobile-3728

的旧教程

任何帮助将不胜感激!谢谢!

  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();

1 个答案:

答案 0 :(得分:1)

试试这个......

loginConnect.send(JSON.stringify(params));