ajax表单校验

var formData = new FormData(document.querySelector("#guestbook_form"));

$.ajax({
    url: "/send_submit",
    type: 'post',
    data: formData,
    processData: false,
    contentType: "application/x-www-form-urlencoded",
    dataType: "json",
    success: function(response) {
        if (response.code == 200) {
            // showAlertMsg(response.msg);
            alert(response.msg);
            location.reload();
        } else {
            // alert(33); return false;
            showAlertMsg(response.msg);
        }
    }
});

 

posted @ 2022-09-13 15:01  谢凌  阅读(31)  评论(0)    收藏  举报