serializeJSON(postMan中使用json形式)

serializeJSON教程

cdn

<%--seralizeJson--%>

javascript

serializeJSON(postMan中使用json形式)_第1张图片
image.png
        $.ajax({
                url:"newTopic",
                dataType: "json",
                contentType:"application/json;charset=UTF-8",
                type:"post",
                data:JSON.stringify($('#topicForm').serializeJSON())  ,
                beforeSend:function(){
                    $("#sendBtn").text("发布中").attr("disabled","disabled");
                },
                success:function(json){
                    if(json.status == "success"){
                        window.location.href="/topicDetail?topicid="+json.data.id;
                    }else {
                        swal("新增主题异常");
                    }
                },
                error:function(){
                    swal("服务器异常");
                },
                complete:function () {
                    $("#sendBtn").text("发布主题").removeAttr("disabled");
                }

            })

控制器

serializeJSON(postMan中使用json形式)_第2张图片
image.png

你可能感兴趣的:(serializeJSON(postMan中使用json形式))