难忘的JS传参问题

在做微信支付的时候,支付按钮一直点击不动

随机拿了一个用户的浏览器信息:

"Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) 
Mobile/13F69 MicroMessenger/6.5.8 
NetType/WIFI Language/zh_CN"

Google模拟调试也没用~
调用特么没任何反应,用户一直反馈说按钮点击没反应,茫然了好几天

------------------------------------------------------

今天晚上终于有一位用户拿了一台iPhone过来调试。晕死

发现2个问题:

1、用了这种传参获取form表单数据

getFormJson(){
    var obj = {};
    var t = $(form).serializeArray();
        $.each(t, function() {
          obj[this.name] = this.value;
    });
    return obj;
}
var _form = getFormJson('#top-up-mifi-form');
改成:

var _form = {};
var t = $('#top-up-mifi-form').serializeArray();
$.each(t, function() {
    _form[this.name] = this.value;
});

2、这种也不行,不知道是不是我不熟悉js语法

        function disableFunc(i=true){
            if(i == true){
                document.getElementById("topUp").setAttribute("disabled", "disabled");
                document.getElementById("topUp-auto").setAttribute("disabled", "disabled");
                document.getElementById("topUp-noAuto").setAttribute("disabled", "disabled");
            } else{
                document.getElementById("topUp").removeAttribute("disabled");
                document.getElementById("topUp-auto").removeAttribute("disabled");
                document.getElementById("topUp-noAuto").removeAttribute("disabled");
            }
        }

改成:

        function disableFunc(i){
            if(i == ''){
                i == true;
            }
            if(i == true){
                document.getElementById("topUp").setAttribute("disabled", "disabled");
                document.getElementById("topUp-auto").setAttribute("disabled", "disabled");
                document.getElementById("topUp-noAuto").setAttribute("disabled", "disabled");
            } else{
                document.getElementById("topUp").removeAttribute("disabled");
                document.getElementById("topUp-auto").removeAttribute("disabled");
                document.getElementById("topUp-noAuto").removeAttribute("disabled");
            }
        }


惨痛的教训啊
哪位前辈知道这是啥问题,一脸茫然~


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值