Hi...
I m developing a gadget, it makes a call for an external REST webservices. The call sends an project ID, and returns a JSON format response.
Debugging in Chrome, the JSON response seems to be OK, but in the gadget s view, when i m referring the arg s key, all the values are 'Undefined'.
I try with a REST webservices from JIRA (/rest/gadget/1.0/currentUser for example) and the response and parse it s OK.
A excerpt from the gadget code is:
config:{
descriptor: function(args) {
var gadget = this;
return {
action: "/rest/gadget/1.0/project/validate",
fields: [
AJS.gadget.fields.projectsOrCategoriesPicker(gadget, "projectsOrCategories", args.options),
{
userpref: "columnasGadget",
label: "Columnas",
description: "Seleccione las columnas a mostrar",
type: "checkbox",
selected: gadget.getPref("columnasGadget"),
}
},
args: function()
{
return [
{key: "options",
ajaxOptions: "/rest/gadget/1.0/projectsAndProjectCategories"
} ];
}()
},
view:
{
template: function(args) {
var gadget = this;
alert("ID PROJECTO:" + args.jsonFile["areaId"]);
},
args: [{
key: "jsonFile",
ajaxOptions: function() {
return {
url: "http://MYRESTWEBSERVICE?CodigoID=" + projectsOrCategories.value,
type: "GET",
dataType: "json",
headers: {Authorization: "Basic " + btoa("XXXXX:XXXX")},
};
}
}]
}