jquery获取表单中的数据

           <form>

                <input name="username" type="text"/>

                <input name="password" type="password"/>

                <input id="submitButton" type="button" value="submit">

            </form>

             $("#submitButton").click(function(){
                    var data = {};
                var t = $('form').serializeArray();
                $.each(t, function() {
                     data [this.name] = this.value;
                });
                alert(JSON.stringify(data));
            });
上一篇:关于运行ORB-SLAM2函数_serialize报错的原因


下一篇:表单序列化的几种方式