0
I’m having trouble accessing the api using the function $.ajax({})
jQuery.
The Error:
My code:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script>
function auth() {
var credentials = {
apikey: "my_apiKey",
username: "myuser",
userkey: "my_userKey"
};
$.ajax({
type: "POST",
contentType: "application/json",
url: "https://api.thetvdb.com/login",
data: credentials,
dataType: "json",
success: function(data) {
console.log(data);
}
});
}
auth();
</script>
</head>
<body>
</body>
</html>
I tested using the program Advanced REST client
, and worked perfectly, returned me the token
.
I’m using the Chrome browser, but I tested in edge/ie and gave the same error.
Does anyone know how I can fix this??
Interesting, but the api I am trying to access is third party, I do not have access to the server..
– MeuChapeu