错误提示:

No Access-Control-Allow-Origin
Referrer-Policy : strict-origin-when-cross-origin


Nginx配置

server {
        client_max_body_size 50M;
	add_header 'Access-Control-Allow-Origin' '*';
	add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
	add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';	        
        
        location / {	
			root   /usr/local/nginx/html;
        }
}


JavaScript调用

<html>
<head>
    <meta charset="UTF-8" />
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
    <script>
        function demo() {
            var url = "http://xxx.xxx.xx.xxx/webAPI/pe.php?pass=hxxxx&key=hnxhpxxxxxxx";
            $.post(url, function (data) {
                $("#result").html(data);
            });
        }
    </script>
</head>
<body>
    <div id="result" name="result"></div>
</body>
</html>
<script>
    demo();
</script>