0
I am trying to make a request to an external API but in the console appears the following error:
Code in Jquery:
$("#Compilar").click(function () {
var codigo = $("#CodigoText").val();
var clientId ='a73f624a200e1e5d02845826ce3f5af7';
var clientSecret = '698b340ea431e964a83deeafff295fb796a6e1ebde4978de3c48819c46c947d3';
var script = codigo;
var stdin = 'StdIn';
var language = 'c';
var versionIndex = '3';
$.ajax({
type: 'POST',
clientId,
clientSecret,
script,
stdin,
language,
versionIndex,
url: 'https://api.jdoodle.com/v1/execute',
dataType:'json',
success: function (resposta) {
console.log(resposta)
},
error: function (resposta) {
alert(resposta);
}
});
});
All right I understood what it is, but it didn’t solve my problem...
– VINICIUS FERNANDES EUGÊNIO
We have to see a few things.. this error occurs because the request for the API is from a different source, do you have access to the API source code? if yes, you can change to allow requests from any source, if you do not have access you have to see in the API documentation what is required to communicate with it.
– Barbetta
then the API link is the following https://www.jdoodle.com/compiler-api/docs, but I am trying to request on by the localhost the system was not hosted something there is?
– VINICIUS FERNANDES EUGÊNIO