javascript - textStatus error in ajax is reported as parsererror?
滿天的星座
滿天的星座 2017-06-23 09:12:53
0
4
856

The textStatus error in ajax is parsererror.

     

Please give me some advice. I have never encountered this problem before. You can also find other methods. Just wait.

滿天的星座
滿天的星座

reply all (4)
黄舟

This probably needs to be combined with the background and specify a parameter namedjsonpCallback.

    学习ing

    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

      /** * 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); } }
        Peter_Zhu

        The dataType returned by the background is inconsistent with the dataType requested by ajax

          Latest Downloads
          More>
          Web Effects
          Website Source Code
          Website Materials
          Front End Template
          About us Disclaimer Sitemap
          php.cn:Public welfare online PHP training,Help PHP learners grow quickly!