415 Unsupported Media Type

The server refused this request because the request entity is in a format not supported by the requested resource for the requested method

 

原因是传入json,未指定contentType : 'application/json',

 

解决:ajax方法中加入 contentType : 'application/json',

$.ajax({
            type:"post",
            url:"/addStudent",
            contentType : 'application/json',
            data:data,
            success:function(result) {
                alert(JSON.stringify(result));
            },
            error:function() {
                alert("error");
            }
            
        });

posted @ 2018-03-21 14:01  教主陈  阅读(281)  评论(0编辑  收藏  举报