I'm trying to delete an image with the REST API of Uploadcare, I'm doing exactly like the documentation and this post says, but still can't manage to delete an image, here is my code:
The html:
<html>
<script charset="utf-8" src="https://ucarecdn.com/libs/widget/3.2.2/uploadcare.full.min.js"></script>
<body>
<div class="main">
</div>
<div>
<button class="uploader">Upload an image</button>
<input class="deletet" />
<button class="getit">delete something</button>
</div>
</body>
<footer>Developep by Francisco Jimenez</footer>
</html>
The javascript:
function deleteb(uuid){
$.ajax({`
url: "https://api.uploadcare.com/files/"+uuid+"/",`
type: "DELETE",
headers: { "Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "*",
"Accept": "application/vnd.uploadcare-v0.5+json",
"Access-Control-Allow-Methods": "HEAD, GET, OPTIONS",
"Authorization": "Uploadcare.Simple publickey:privatekey"
},
success: function(result){
alert("yessss");
console.log(result);
},
error: function (result){
alert("ouuuh");
console.log(result);
}
});
}
The response that i keep getting is: Cross-Origin Request Blocked
: The Same Origin Policy disallows reading the remote resource at https://api.uploadcare.com/files/c2e166b5-17b9-493f-bf8c-b33da27842ca~1/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
What I'm doing wrong?