Home >Backend Development >PHP Tutorial >一个ajax跨域问题

一个ajax跨域问题

WBOY
WBOYOriginal
2016-06-20 12:26:21909browse

提示是这个XMLHttpRequest cannot load http://localhost/admin/index.php?act=mb_special&op=special_item_add. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1' is therefore not allowed access.

似乎本地环境不允许,假如非要在本地做,怎么解决此问题


回复讨论(解决方案)

楼主想要做的是什么??你这个请求涉及到跨域请求的东西,跨域直接这样请求是接收不到返回值的。

Header("Access-Control-Allow-Origin: * ");
Header("Access-Control-Allow-Methods: POST, GET");
跨域请求会出现一些不安全的问题

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