如何解决Access to XMLHttpRequest at ‘http://127.0.0.1:8000/cors-server‘ from origin ‘null‘

AJAX问题:

Access to XMLHttpRequest at 'http://127.0.0.1:8000/cors-server' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

 解决办法:设置响应头

    response.setHeader("Access-Control-Allow-Origin","*");

你可能感兴趣的:(AJAX,ajax)