pennyoy
pennyoy
  • 发布:2015-06-26 17:56
  • 更新:2015-06-26 18:44
  • 阅读:2245

在mui.ajax 的success回调函数里调用5+ api提示plus is not defined

分类:HTML5+

在mui.ajax 的success回调函数里调用5+ api偶尔会提示plus is not defined,前提是ajax函数是在mui.plusReady里调用的,,请问是什么问题?

2015-06-26 17:56 负责人:无 分享
已邀请:
DCloud_UNI_FXY

DCloud_UNI_FXY

贴一下代码,贴一下报错误的console截图

pennyoy

pennyoy (作者)

mui.plusReady(function(){  
        document.getElementById('login').addEventListener('tap',function(e){  
        var username = document.getElementById('username');  
        var pwd = document.getElementById('userPwd');  
        mui.ajax('http://goochange.kdapp.net/communication/interface',  
            {data:{  
                actiontype:'rfjSE2Gujo8SMUQnTDqfspwTuczHl68J',  
                username:username.value,  
                pwd:pwd.value  
                },  
            dataType:'json',  
            type:'post',  
            timeout:5000,  
            success:function(data){  
                if(data.length>0){  
                       UserInfo.clear(); //清除登录状态信息  
                    UserInfo.username(data[0].userName);  
                    UserInfo.password(data[0].userRealName);  
                    UserInfo.token(data[0].userId);  

                    mui.toast('登入成功!');  
                    mui.fire(plus.webview.getWebviewById('index-menu'),'login',{status:'注銷登入'});  
                    mui.fire(plus.webview.getLaunchWebview(),'showAllWebview',{});  
                    plus.webview.currentWebview().close();  
                }else{  
                    mui.toast('用戶名或密碼錯誤,請重新輸入 !');  
                    }  
                    }  
        })  
    })  
})
  • DCloud_UNI_FXY

    那个应该是runtime内部的错误。你重启真机联调再试试,看看还报错不了,有时候真机联调的时候,修改代码,不重启的话,会有一些错误

    2015-06-26 18:57

  • pennyoy (作者)

    他有时候出错,有时候又正常,我想问一下逻辑上有没有问题?

    2015-06-26 19:02

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