AJS.$.ajax async: false does not work in confluence

winter wong September 4, 2019

 I am writing a  jira gadget, but the ajax async works on Jira dashboard but doesn't work in confluence external gadget.

In Jira Dashboard both mapNum and mapProjectList are identified but in Confluence side, it seems running return and then mapNum and mapProjectList are identified. The async doesen't work. This is the code:

args: [{
key: "chart",
ajaxOptions: function () {
var mapProjectList=[];
var mapNum="";

AJS.$.ajax({
url: "/rest/api/2/search?jql=type=Initiative&fields=customfield_12001,project&maxResults=5000",
type: "GET",
dataType: "json",
async: false,
contentType: "application/json",
success: function generate(data) {
//setting mapNum and mapProjectList
});

return {
url: "/rest/initiativeparentlinkgadget/1.0/LenovoPiechartDefect/generatePieChartDefectImage",
data: {
mapNum:mapNum,
mapProjectList:JSON.stringify(mapProjectList),
}
};
}
}]

1 answer

1 accepted

0 votes
Answer accepted
winter wong September 17, 2019

move the AJS.$.ajax to view section, it works

Suggest an answer

Log in or Sign up to answer