【发布时间】:2015-07-21 09:52:04
【问题描述】:
我正在使用 JIRA 的 API 来获取有关错误的一些信息。这是我用来获取它的 JQuery 示例:
var endpoint = 'https://jira.cyanogenmod.org/rest/api/latest/issue/CYAN-2631';
$.get(endpoint, function(data) {
do_stuff(data, data['fields']['project']['self']);
});
而且,我遇到了可怕的Access-Control-Allow-Origin 错误。它看起来像这样:
XMLHttpRequest cannot load
https://jira.cyanogenmod.org/rest/api/latest/issue/CYAN-2631.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://127.0.0.1:8000' is therefore not allowed access.
如果可能的话,我真的很想使用这个 API。遵循question 上的指示并没有帮助。我又遇到了一个错误,
GET https://jira.cyanogenmod.org/rest/api/latest/issue/CYAN-2631callback=jQuery172039181585889309645_1431307158851?_=1431307165515
似乎是一个 Jquery 错误,所以我认为这不是正确的方法。也许服务器不允许jsonp。
无论如何,有没有人有办法解决这个问题,或者我可以不使用这个特定的 API?谢谢
【问题讨论】:
-
你应该问 JIRA。
标签: javascript jquery api cross-domain