点击页面的“发送哀求”按钮,会返回如下错误:
Access to XMLHttpRequest at 'http://localhost:8081/test.php' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
GET http://localhost:8081/test.php net::ERR_FAILED
想要乐成从服务器中获取数据,就可以使用我们上面介绍的 JSONP 来实现,实现步骤如下: