policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
展开阅读全文

policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

解决方法:

宝塔解决跨域的问题

宝塔的nginx配置里面加入:

    add_header Access-Control-Allow-Origin * always;
	add_header Access-Control-Allow-Methods GET,POST,DELETE; 
	add_header Access-Control-Allow-Header Content-Type,*;

最终效果:

server
{
    listen 80;
	listen 443 ssl http2;
    server_name jsyzmzdq.com *.uq728.cn uq728.cn;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/jsyzmzdq.com/public;
    add_header Access-Control-Allow-Origin * always;
    add_header Access-Control-Allow-Methods GET,POST,DELETE;  
    add_header Access-Control-Allow-Header Content-Type,*;