ajax post submission using Shique being given Request "GET" Unsupport

Add in ajax dataType in: "json"
The reason given is online ajax cross-domain requests submitted from time to time, the default is jsonp dataType to springmvc, but does not support cross-domain requests jsonp
So instead

$.ajax({
                // 报了415错误   jquery-1.12.4.min.js:4 POST http://localhost:8080/Employee/save_employee 415 (Unsupported Media Type)
                url:"${pageContext.request.contextPath}/Employee/save_employee",
                //解决:  添加dataType
                dataType:"json",
                type:"POST",
                data:$('#empAddModal form').serialize(),
                // data:$('#empAddModal form').serialize(),

                // ContentType:"application/x-www-form-urlencoded",
                success: function(result){

After the change has given a 500 error, and then view the server
because the validation error input box, changed and being given

java.sql.BatchUpdateException: Duplicate entry '12' for key 2
因为数据库中设置了  number   唯一性,改掉,对了
Released six original articles · won praise 5 · Views 358

Guess you like

Origin blog.csdn.net/qq_42840001/article/details/84702789