chenge-0401

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");
            }
            
        });

分类:

技术点:

相关文章: