我在尝试向 IFTTT maker 频道执行 $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.
我有 cordova-whitelist 插件,并尝试了添加Access-Control-Origin
到标题的各种解决方案,但仍然得到类似的响应。