javascript - 使用webapp开发钛json未知错误

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

最佳答案

试试这个...

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

关于javascript - 使用webapp开发钛json未知错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23644229/

相关文章:

c# - .net 4.0 中返回 xml 而不是 json 的 asmx web 服务

titanium - 为 iTunes Store 构建后发布 iOS10/Xcode 8.0 "Missing Push Notification Entitlement"错误

javascript - 如何使用 android webview 在 appcelerator 的 titanium 移动应用程序上进行地理定位

javascript - 之后使用 jquery 添加包含 ng-if 的元素

java - 以列表形式获取 JSON 键值的方法

javascript - 在 json 中解码 html

ios - Titanium/如何临时存储照片以在以后的功能中使用

javascript - 将类添加到动态加载的菜单

javascript - RapidAPI 响应体显示为 "undefined"

JavaScript 正则表达式,替换除给定选择之外的所有字符。