我在尝试对IFTTT制作商频道执行$ http.post时遇到问题。下面是我用来执行POST代码:
$http.post(
'https://maker.ifttt.com/trigger/{my-event}/with/key/{my-key}',
{value1:"hello",value2:"goodbye"}
).then(
function successCallback(response) {
console.log(response);
},
function errorCallback(response) {
console.log("error: ",response);
});
我得到的回应是:
XMLHttpRequest cannot load https://maker.ifttt.com/trigger/{my-event}/with/key/{my-key}.
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.
我有科尔多瓦白名单的插件,并尝试各种解决方案添加Access-Control-Origin
到标题,并仍然得到类似的回应。
这是一个浏览器错误? – Akis
我不这么认为。我在几台浏览器和几台机器上试过了。还是一样的错误。 – zsoflin
有一个使用CORS插件的解决方法https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi – Akis