I have a problem when consuming a Rest service with Jquery, I have no problem with tools like Insomnia or the browser.
$.ajax({
type: "GET",
url: "http://sanguchi.esy.es/peoples",
contentType: 'application/json',
dataType: "json",
success: function (data) {
alert("success");
},
error: function (jqXHR, status) {
alert("error"); //Siempre ejecuta esto
}
});
What should return is the following:
[{ "id": "1","nombre": "aaaa" }, {"id": "2", "nombre": "bbb"} ]