I'm trying to send a request using Jquery using the Redmine API, which says it has support for jsonp.
So, i tried differents ways to make request with Jquery and i already search for the 'mime type' errors and try to solve using the answers but the throw error in the console is evertime the same (Google Chrome):
refused to execute script from
'http://redmine_domain_sample/users/current.json?callback=jQuery21309665620597314108_1508906065651&_=1508906065652'
because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.
And in the Firefox:
SyntaxError: missing ; before statement
apponiting to the json that really returns my data. when i click i can see the data:
This is my code:
$("#redmine").click(function() {
$.ajax({
type:"get",
url:"http://redmine_domain_sample/users/current.json",
dataType: "jsonp",
contentType: "application/javascript",
success: function(response) {
alert(response.firstname);
exibeProjetosRedmine();
}
});
});
This url make an authentication request, which works, so when i input the login data, the errors on top appears.
If i make this request from an extension client , for example, the chrome Advanced REST Client, it works, but in my localhost Laravel application doesnt.
The request return 200 ok
, but the Jquery request dont goes to the success function. I really even tried some solutions when i searching like:
format=json
in urlbut dont work. What i'm doing wrong? I believe that is a simple error but i really not understand yet. Thanks.
Thanks all. But i solved the problem just with communication. Redmine API accepts jsonp, but this is, by default, disabled. So, i can't make request with jsonp if the domain don't allows that. No way.
Happily, i meet the redmine domain admin that i tried to access. And i asked for allows that in the administration config (docs say that) allowed jsonp
. And he's made it and i solved my problem.