Hey there! I have some code that I need help with
var idx = 0;
var size = 0;
do {
response.push({
key: "data" + idx,
ajaxOptions: function () {
var data = this.getPref("groupsCN");
var items = data.split(';');
size = items.length;
idx++;
alert('inside index: ' + idx + ' < inside length ' + size);
return {
url: '/rest/adrestresource/1.0/activedirectory/findgroups&<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2652435552664a4744084a4945474a">[email protected]</a>&Bezhesla1&localhost&',
type: "GET",
dataType: "xml"
}
}
});
alert('outside index: ' + idx + ' < outside length ' + size);
} while (idx < size);
The purpose of the getPref
function is to load a string containing values separated by semicolons. The goal is to iterate through these values and perform certain actions on them. However, the current output of the code is
outside index: 0 < outside length: 0
This indicates that the variables idx
and size
are not being modified within the function. I'm puzzled as to why this is happening.
I have to include this.getPref()
within ajaxOptions -> function
, as it does not function correctly when placed outside of it (unfortunately, this function is part of the Atlassian gadget JavaScript framework)