当前位置:Gxlcms > PHP教程 > 一个ajax跨域问题

一个ajax跨域问题

时间:2021-07-01 10:21:17 帮助过:35人阅读

提示是这个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");
跨域请求会出现一些不安全的问题

人气教程排行