小健
小健
  • 发布:2016-04-06 17:08
  • 更新:2016-04-25 18:14
  • 阅读:1470

新建了一个开户申请表,用了mui.ajax,提交后报如果错误怎么解决?

分类:MUI

新建了一个开户申请表,用了mui.ajax,提交后报如果错误怎么解决?
[ERROR] : RangeError: Maximum call stack size exceeded.
file name:js/mui.min.js
line no:101

代码:

(function($, doc) {  
                $.init();  
                $.plusReady(function() {  
                var state = app.getState();  
                var kaihuButton = doc.getElementById('kaihu');  
                var nameBox = doc.getElementById('name');  
                    var pinyinBox = doc.getElementById('pinyin');  
                    var sexBox = doc.getElementById('sex');  
                    var ageBox = doc.getElementById('age');  
                    var birthdayBox = doc.getElementById('birthday');  
                    var addressBox = doc.getElementById('address');  
                    var accountBox = doc.getElementById('account');  
                    var emailBox = doc.getElementById('email');  
                    var id_cardBox = doc.getElementById('id_card');  

                    kaihuButton.addEventListener('tap', function(event) {  
                        var kaihuInfo = {  
                            'state': state,  
                            name: nameBox.value,  
                            pinyin: pinyinBox.value,  
                            sex: sexBox.value,  
                            age: ageBox,  
                            birthday: birthdayBox.value,  
                            address: addressBox.value,  
                            account: accountBox.value,  
                            email: emailBox.value,  
                            id_card: id_cardBox.value  
                        };  

                        app.mit(kaihuInfo, function(err) {  
                            if (err) {  
                                plus.nativeUI.toast(err);  
                                return;  
                            }  

                            plus.nativeUI.toast('提交成功');  
                            $.openWindow({  
                                url: 'kaihu_success.html',  
                                id: 'kaihu_success',  
                                show: {  
                                    aniShow: 'pop-in'  
                                }  
                            });  
                        });  
                    });  

                });  
            }(mui, document));

app.js 文件里的代码

(function($, owner) {  
    /**  
     * 開戶資料提交  
     **/  
    owner.mit = function(kaihuInfo, callback) {  
        callback = callback || $.noop;  
        kaihuInfo = kaihuInfo || {};  
        kaihuInfo.account = kaihuInfo.account || '';  
        if (kaihuInfo.name.length < 4) {  
            return callback('真实姓名最短需要 4 个字符');  
        }  
        if (kaihuInfo.pinyin.length < 4) {  
            return callback('姓名拼音至少 4 个字符');  
        }  
        if (kaihuInfo.age == '') {  
            return callback('请填写真实年龄');  
        }  
        if (kaihuInfo.birthday == '') {  
            return callback('请填写生日');  
        }  
        if (kaihuInfo.address == '') {  
            return callback('请填写联系地址');  
        }  
        if (kaihuInfo.account == '') {  
            return callback('请填写手机');  
        }  
        if (kaihuInfo.id_card == '') {  
            return callback('请填写身份证号码');  
        }  
        if (!checkEmail(kaihuInfo.email)) {  
            return callback('邮箱地址不合法');  
        }  
        function kaihuadd(option,kaihu_fun){  
                Post(KAIHU_ADD,option,kaihu_fun);}  
        function kaihu_callbackFun(data){  
                if(data.list.code == 1) {    
                    return callback();  
                }else{  
                    mui.alert(data.list.msg, "系统消息", "关闭");   
                return;  }          
        }  
        kaihuadd(kaihuInfo,kaihu_callbackFun);  

    };  
}  
(mui, window.app = {}));  

common.js里的代码

var SERVERE='http://huodong.fmoservice.com/fmoapp/index.php/';//服务器  
var KAIHU_ADD = SERVERE + 'Kaihu/add';  

function log(data){  
    console.log(JSON.stringify(data));  
}  

(function(w){  
    w.Post=function(url,option,func){  
        mui.ajax(url,{  
            data:option,  
            dataType:'json',//服务器返回json格式数据  
            type:'post',//HTTP请求类型  
            timeout:10000,//超时时间设置为10秒;  
            success:function(data){  
            //服务器返回响应,根据响应结果,分析是否登录成功;  
                func(data);  
            },  
            error:function(xhr,type,errorThrown){  
            //异常处理;  
            console.log(type);  
            }  
        });  
    };  
    w.Get=function(url,option,fun){  
        mui.ajax(url,{  
            data:option,  
            dataType:'json',//服务器返回json格式数据  
            type:'get',//HTTP请求类型  
            timeout:10000,//超时时间设置为10秒;  
            success:function(data){  
            //服务器返回响应,根据响应结果,分析是否登录成功;  
                fun(data);  
            },  
            error:function(xhr,type,errorThrown){  
            //异常处理;  
            console.log(type);  
            }  
        });  
    };  
    /**  
     * id元素点击事件  
     * @param {Object} selector  所要操作控件的id  
     * @param {Object} func  所要执行的回调函数  
     */  
    w.Click=function(selector,func){  
        document.getElementById(selector).addEventListener('tap', func);  
    }  
    /**  
     * 批量监听点击事件  
     * @param {Object} parent 父类选择器  
     * @param {Object} selector 所要监听的所有控件选择器  
     * @param {Object} func 回调函数  
     */  
    w.On=function(parent,selector,func){  
        mui(parent).on('tap',selector,func);  
    }  
    w.LastSubstr=function(str){  
        return str.substring(0,str.length-1);  
    }  

})(window);  
2016-04-06 17:08 负责人:无 分享
已邀请:
小健

小健 (作者)

自己找到错误了,定义age数值时少了一个value

age: ageBox.value,

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