Tips, this is a cross-domain issue. If you wrote the backend, you can configure Cors. The code is as follows. I hope it can help you. By the way, spring needs to be scanned
/** * Created by sunny on 2017/6/22. */ public class CorsConfig extends WebMvcConfigurerAdapter { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedOrigins("*") .allowCredentials(true) .allowedMethods("GET", "POST", "DELETE", "PUT") .maxAge(3600); } @Override public void addInterceptors(InterceptorRegistry registry) { WebContentInterceptor webContentInterceptor = new WebContentInterceptor(); CacheControl nocache = CacheControl.noCache(); webContentInterceptor.addCacheMapping(nocache, "/**"); registry.addInterceptor(webContentInterceptor); } }
This probably needs to be combined with the background and specify a parameter named
jsonpCallback
.Is the returned thing in jsonp format?
Tips, this is a cross-domain issue. If you wrote the backend, you can configure Cors. The code is as follows. I hope it can help you. By the way, spring needs to be scanned
The dataType returned by the background is inconsistent with the dataType requested by ajax