用JQUERY做大表单(多表单域)AJAX提交

    function postData() {
        var post = "";
        $(":text").each(function() {
            post += "&" + this.name + "=" + this.value;
        });
        $(":password").each(function() {
        post += "&" + this.name + "=" + this.value;
        });
        return post;
    }

    var ajaxCheck = function(dataStr) {

        $.ajax(
        {
            type: "GET",
            async: false,
            url: window.location.href,
            dataType: "json",
            data: dataStr,
            success: function(data) {
                flag = data.Result;
                message = data.Message;
                dbExists = data.Exists;
            }
        });
    }

//调用
urlStr = "type=checked" + postData();
ajaxCheck(urlStr);
原文地址:https://www.cnblogs.com/liulun/p/1862118.html