I'm trying to reach an API from inside my tag manager. The language to use for the so-called building blocks in this tag-manager is JavaScript. The POST API I am trying to use is fully functioning and works like this:
input:
{"features": "xyz"}
output:
[0.45]
I set up an ajax statement, but it does not seem to work.
I have tried all different kinds of input and content types. The code looks like this:
$.ajax({
url: apiurl,
type: "POST",
data: {"features": "xyz"},
contentType: "application/json; charset=utf-8",
success: function (data) {
console.log(data)
},
error: function(){
console.log("Error"); }
});
What I am doing wrong here? I keep getting error messages.