簡體   English   中英

如何使用 JS 在 JIRA 問題頁面上獲取附件 ID?

[英]How to grab Attachment ID on JIRA Issue Page using JS?

我正在使用 ajax 調用,其 url 需要附件 id。 我現在正在使用一個硬編碼的 url,它是 url: AJS.contextPath()+"/rest/api/latest/attachment/10415"

jQuery.ajax({
url: AJS.contextPath()+"/rest/api/latest/attachment/10415",
TYPE: "GET",
//dataType: "application/json",
dataType: "text",
success: function(data){
    console.log("Success");
},
error: function(data){
    console.error("Error with attachments");
},
}).done(function(data){     
console.log("Done with greying attachments");
});

所以這僅適用於 ID 為 10415 的附件。我正在考慮進行 2 個 ajax 調用,上面的一個是第二個。 第一個具有 AJS.contextPath()+"/rest/api/latest/issue/${issueId} 的 url,它返回上述 ajax 調用的內容 url。

我是 ajax 的新手,所以我不確定這是否有效。 另外,數據類型應該是“text”還是“application/json”?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM