Php 原产地问题
URL:当我点击调用api时,它的本地主机是一样的,但它的live server是0 我是按邮政要求取暖的,但正在将其转换为邮政取暖选项 发生错误:选项405(不允许使用方法) var data=“{\n\“name\”:\“dsd\”\n\“task\”:\“dhdkjdhkjdshdasj\”,\n'\n}” var data=“{\n\“name\”:\“dsd\”\n\“task\”:\“dhdkjdhkjdshdasj\”,\n'\n}” html:26选项405(不允许使用方法) (匿名)@test.html:26Php 原产地问题,php,Php,URL:当我点击调用api时,它的本地主机是一样的,但它的live server是0 我是按邮政要求取暖的,但正在将其转换为邮政取暖选项 发生错误:选项405(不允许使用方法) var data=“{\n\“name\”:\“dsd\”\n\“task\”:\“dhdkjdhkjdshdasj\”,\n'\n}” var data=“{\n\“name\”:\“dsd\”\n\“task\”:\“dhdkjdhkjdshdasj\”,\n'\n}” html:26选项405(不允许使用方法) (
test.html:1 CORS策略已阻止从源站“null”访问“”处的XMLHttpRequest:对飞行前请求的响应未通过访问控制检查:请求的资源上不存在“访问控制允许源站”标头。请在此处添加这些标头。我遇到了相同的问题,并通过以下方式修复:
我添加了这个共享代码:header(“访问控制允许源代码:”);标题(“访问控制允许标题:”代码>但仍然保持不变error@GajendraBitcot您可以通过检查网络选项卡并清除缓存来确认吗?带有POST数据的“网络”选项卡的屏幕截图将非常棒。@GajendraBitcot您想快速查看一下吗
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://localhost:8080/v1/integration/dataset");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.send(data);
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://localhost:8080/v1/integration/dataset");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.send(data);