05309
05309
  • 发布:2018-07-13 16:28
  • 更新:2018-07-13 16:34
  • 阅读:706

ajax登录提交不更新

分类:MUI

这种是什么情况的,重新输一个帐号,还是提示最先的帐号,空白的也可以提交返回这个帐号

后端是自带有验证的

2018-07-13 16:28 负责人:无 分享
已邀请:
回梦無痕

回梦無痕 - 暂停服务

看你的描述,可能是后端的问题,可能是前端有缓存账号,一个界面截图,不知道代码无法分析问题的。
请上传一个能重现问题的最简化dome或代码。

  • 05309 (作者)

                //logo Start  
    var lastupdate = Math.round(new Date().getTime() / 1000).toString();
    var username = document.getElementById("username");
    var password = document.getElementById("password");
    //发送请求按钮的点击事件
    document.getElementById("loginBtn").addEventListener('tap', function() {
    var url = "http://www.cmsbj.cn/api/mobile/index.php?mobile=no&version=1&module=login&loginsubmit=yes&loginfield=auto";
    mui.ajax(url, {
    data: {
    username: username.value,
    password: password.value,
    lastupdate:lastupdate

    },
    dataType: 'json', //服务器返回json格式数据
    type: 'post', //HTTP请求类型
    timeout: 1000, //超时时间设置为10秒;
    success: function(data) {
    var formhash = data.Variables.formhash;
    var auth = data.Variables.auth;
    var ucid = data.Variables.member_uid;
    if(ucid>0){
    localStorage.setItem('formhash',formhash);
    localStorage.setItem('auth',auth);
    localStorage.setItem('ucid',ucid);
    //mui.back();
    }
    plus.nativeUI.toast(data.Message.messagestr);

    console.log(data.Variables.member_uid); //打印看看

    },
    error: function(xhr, type, errorThrown) {
    //异常处理;
    console.log(type);
    }
    });
    });
    //logo End

    2018-07-13 17:01

  • 05309 (作者)

    api/mobile/index.php?mobile=no&version=1&module=login&loginsubmit=yes&loginfield=auto

    2018-07-13 17:02

  • 回梦無痕

    回复 1***@qq.com:把这三行

    var lastupdate = Math.round(new Date().getTime() / 1000).toString();

    var username = document.getElementById("username");

    var password = document.getElementById("password");

    放到tap事件里面去就行了,出现问题的原因是你直接用了初始的数据没有在每次点击都获取输入框数据。

    2018-07-13 17:11

  • 回梦無痕

    回复 1***@qq.com:就是放到这一行的下面

    document.getElementById("loginBtn").addEventListener('tap', function() {

    2018-07-13 17:14

该问题目前已经被锁定, 无法添加新回复