js serialize()

//提交

    $("input[type='button']").eq(1).click(function () {

        var data=$("#form").serialize();

        var url=$("#form").attr('action');

//        alert(data);return false;

        $.ajax({

            type:'post',

            url:url,

            data:data,

            success:function (msg) {

                if(msg=='false'){

                    alert("注册失败");

                    return false;

                }

                alert("注册成功");

                location.href="http://127.0.0.1/index1.php";

            }

        })

    })

原文地址:https://www.cnblogs.com/huhewei/p/12687692.html