参考文档:https://blog.csdn.net/jslcylcy/article/details/52789575
前端:
$.ajax({
type : "POST",
url : "student",
dataType : "json",
async : false,
data : {
provinceIds : array,
//该参数指定后台接受方法类型,put/delete
_method : "delete",
},
success : function(data) {
});
解决html跨域问题:
private CorsConfiguration buildConfig() { CorsConfiguration corsConfiguration = new CorsConfiguration(); corsConfiguration.addAllowedOrigin("*"); corsConfiguration.addAllowedHeader("*"); corsConfiguration.addAllowedMethod("*"); return corsConfiguration; } @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", buildConfig()); return new CorsFilter(source); }