The technique of creating script tag with src only works for JSONP, if the url returns JSON instead of JSONP you will have to do a normal HTTP request using jQuery.ajax()
or XMLHttpRequest
or fetch()
. This request may not work if the server is not CORS enabled, if it is not with cors you can use a proxy like crossorigin.me.
Example using XMLHttpRequest
var request = new XMLHttpRequest();
request.open('GET', 'https://crossorigin.me/http://api.bluanime.com/dados/animes/113/episodios');
request.addEventListener('load', function () {
var data = request.response.slice("dados_eps = ".length);
alert(data);
var json = JSON.parse(data);
});
request.send();
Example using JSONP by changing API: link
The api returns something like
callback({"episodes": "123", "_": "1492622616910"});