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

Posted zengjf

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了No 'Access-Control-Allow-Origin' header is present on the requested resource.相关的知识,希望对你有一定的参考价值。

/***********************************************************************
 * No ‘Access-Control-Allow-Origin‘ header is present on the requested resource. 
 * 说明:
 *     之前没考虑到Ajax跨域访问会遇到这个问题,今天梦真在测试的时候看到
 * 这个现象,于是查找资料看一下怎么解决。
 *
 *                                     2016-10-12 深圳 南山平山村 曾剑锋
 **********************************************************************/


一、参考文档:
    js跨域访问,No ‘Access-Control-Allow-Origin‘ header is present on
        http://zjblogs.com/js/Access-Control-Allow-Origin.html

二、解决办法:
    如果请求的url是php页面,则需要在PHP页面中添加代码:header("Access-Control-Allow-Origin: *");

 

以上是关于No 'Access-Control-Allow-Origin' header is present on the requested resource.的主要内容,如果未能解决你的问题,请参考以下文章

Jenkins打包报错:(No such file or directory) and 'parent.relativePath' points at no local POM

VS Code报错Module 'xx' has no 'xx' member pylint(no-member)解决办法

VSCODE 报错 Module ‘xx‘ has no ‘xx‘ member pylint(no-member)

VSCODE 报错 Module ‘xx‘ has no ‘xx‘ member pylint(no-member)

Package 'build-essential' has no installation candidate

module 'pip' has no attribute 'main'