I am trying call a REST API post function from a script embedded into my html file. The button isn't working for some reason and no online resources have helped me thus far. This html code will be sent via email, and person using outlook with open the email and click the link to call the rest api.
Here is the html code:
<a href="#" onclick="markAsDone();" target="_blank" style="font-size: 16px; font-family: Helvetica, Arial, sans-serif; font-weight: normal; color: #ffffff; text-decoration: none; display: inline-block;">I am done. →</a>
<script type="text/javascript">
function markAsDone() {
var xhttp = new XMLHttpRequest();
xhttp.open("POST", "http://localhost:1337/UserDone", false);
xhttp.sendRequestHeader("Content-type", "application/json");
xhttp.send();
}
</script>
Am I doing something wrong or is outlook not compatible for emails containing html with links like this?