Home  >  Article  >  Database  >  关于Access

关于Access

WBOY
WBOYOriginal
2016-06-07 15:42:471087browse

网页乎比flash还严, 子域名之间都不能互相访问 必须在响应页面写什么Access-Control-Allow-Origin配置 但是不是任何时候都有权限写的, 够烦, 先把搜到的链接摆一下 使用ajax的get方式解决了问题, 通过返回参数为script 可以把一个本地的函数通过文本传递给目

网页似乎比flash还严格, 子域名之间都不能互相访问

必须在响应页面写什么Access-Control-Allow-Origin配置

但是不是任何时候都有权限写的, 够烦, 先把搜到的链接摆一下


使用ajax的get方式解决了问题, 通过返回参数为"script" 可以把一个本地的函数通过文本传递给目标网页, 并反馈激活此函数

jQuery.get(url,{callback:"CallBackFunction"},function(json){},"script");

不用去处理后面的方法, 使用此方法不要用临时方法

只针对get, post无法使用此方法


来源:

stackoverflow介绍如何跨域

http://stackoverflow.com/questions/19821753/jquery-xml-error-no-access-control-allow-origin-header-is-present-on-the-req

以脚本方式反馈跨域请求

http://code.eoe.cn/68

这里有解决方法

http://www.cnblogs.com/yoyiorlee/archive/2010/11/07/1871308.html

jQuery.get方式请求页面

http://www.w3school.com.cn/jquery/ajax_get.asp

php的页面修改

http://blog.sina.com.cn/s/blog_6cc9c79b01015gpm.html

http://freewind.me/blog/20140327/2456.html


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn