How to get latest version of a artifact on Bintray using JSONP

久未见 提交于 2019-12-24 02:54:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!