使用ajax方式提交表单,使用的spring mvc ,返回json对象后,出现415错误

宁不诉离殇 发布于 2014/06/30 15:29
阅读 1K+
收藏 0

使用ajax方式提交表单,使用的spring mvc ,返回json对象后,出现415错误,确实值存入数据库了

 $(function () {
            $("#saveBtn").click(function () {
                var uid = $("#userIdInput").val();
                var title = $("#title").val();
                var content = $("#content").val();
                $.ajax({
                    type: "post",
                    url: basePath + "diary/0.json",
                    contentType: 'application/json;charset=utf-8',
                    async:false,
                    data: JSON.stringify({
                        title: title,
                        content: content,
                        user:{id:uid}

                    }),
                    dataType: "json",
                    success: function (result) {
                        alert("添加记录成功");
                    },
                    error: function () {
                        alert("添加失败");
                    }

                });
                event.stopPropagation();

            });
        });

求高手帮助

加载中
0
NotFoundException
NotFoundException
http://my.oschina.net/stonezing/blog/122265  
返回顶部
顶部