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

            }

        })

    })

posted @ 2020-04-12 21:13  一天从晚上开始  阅读(2096)  评论(0编辑  收藏  举报