I've already answered a simular question hhttps://answers.atlassian.com/questions/278734/how-to-grab-attachment-id-on-issue-page-using-js
How to grab Attachment ID on JIRA Issue Page using JS?
-
25-06-2023 - |
Domanda
I am using an ajax call to whose url needs the attachment id. I am using a hardcoded url right now which is 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");
});
So this only works for the attachment with id 10415. I was thinking of making 2 ajax calls, the above one being the second. And the first having a url of AJS.contextPath()+"/rest/api/latest/issue/${issueId} which returns the content url of the above ajax call.
I am new to ajax so I am not sure if this will work. Also, should the dataType be "text" or "application/json"?
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow