难忘的JS传参问题

来源:互联网 发布:php 微信开发 编辑:程序博客网 时间:2024/05/29 14:29

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

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

"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");            }        }


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


原创粉丝点击