Hi all,I'm struggling with a webscript, that I'm calling inside a custom form control to retrieve values for a dropdown. I don't get the response parsed at all. The reason may be that the browser's error console says that the result is not well-formed!? Here is the JacaScript code, that invokes the webscript:<javascript> function selectArchiveId(currentValueHtmlId) { this.currentValueHtmlId = currentValueHtmlId; var selectArchiveId = Dom.get(this.currentValueHtmlId); this.register = function () { Alfresco.util.Ajax.jsonGet({ url: Alfresco.constants.PROXY_URI + "my/company/feature/getArchiveIds", successCallback: { fn: function(res) { var results = Alfresco.util.parseJSON(res.serverResponse.responseText); alert(results); }, scope: this, }, failureCallback: { fn: function () { }, scope: this } }); }; //this.register this.register(); }</javascript>The alert pops up with content:
[object Object]
But I can't access it. The content is always null or undefined. The code above is based on this topic: https://forums.alfresco.com/forum/developer-discussions/alfresco-share-development/dynamic-selectone-alfresco-share-07212014The response from the webscript is:
{"archiveIds":{"K1":"NSP System","Z1":"PEI System","Q1":"KKK Dev System","Q2":"KKK Dev System","Z3":"PEI System","Z2":"PEI System"}}
Something is returned…The error message from the browser is attached as image.I think it's related to the function used for the webscript call: Alfresco.util.Ajax.jsonGet ?But if I try to call the webscript by the Alfresco.util.Ajax.GET function, then this function is not found.If you are interested in the webscript definition itself:
<webscript>
<shortname>Get Dropdown values</shortname>
<description>
Get all dropdown values for archiveId
</description>
<url>/my/company/feature/getArchiveIds</url>
<format default="json"/>
<authentication>user</authentication>
<transaction>none</transaction>
<family>my company</family>
</webscript>
How do I call the webscript correctly? Or how I'm able to access the response? Does anybody know?Thanks,Mario