问题
Bintray provide a REST API to search a artifact with latest version infomation:
https://api.bintray.com/search/packages/maven?q=&g=me.tankery.lib&a=circularSeekBar
I'm trying hard to find a way to get latest version of a artifact on Bintray with Javascript code.
Seems Bintray server not support CORS, I use JSONP to request the data with jQuery:
var url = "https://api.bintray.com/search/packages/maven?q=&g=me.tankery.lib&a=circularSeekBar";
$.getJSON(url, function(response) {
console.log(response);
});
But the response never received. I check the response in Chrome Dev Tools, notice that the response of Bintray REST API has no padding on its JSON data. So the JSONP's callback function never invoke.
What things I can do when server don't support JSONP?
回答1:
Provide a backend yourself which downloads the required data for you and is not subject to the Same-Origin-Policy.
来源:https://stackoverflow.com/questions/37558862/how-to-get-latest-version-of-a-artifact-on-bintray-using-jsonp