ajax - How to get Alfresco webscript JSON response in JavaScript file -
i'm working on alfresco maven sdk project.
so have repo webscript return json response template containinng list of files contained in specific folder (in case it's: espace%20racine/dictionnaire%20de%20données/dossier%20workflow
).
the template response.json.ftl here:
{ "files" : [ <#list folder.children child> <#if child.isdocument> { "name" : "${child.name}" } <#if child_has_next>,</#if> </#if> </#list> ] }
my webscript works fine, , when run through commande line or browser, response like:
{ "files" : [ { "name" : "test" } , { "name" : "test2" } , { "name" : "test3" } ] }
now, want invoke webscript javascript file reside in folder web of share, haven't idea how achieve this. searched on net don't find consistant example how manage this.
it'll me lot if can tell me way achieve or take me example how achieve this.
below code making ajax call in alfresco share.there other methods available alfresco.util.ajax.jsonpost,alfresco.util.ajax.jsonput etc..in below console.log(response.json) print response in console.
var fnsuccess = function response_functionname(response) { console.log(response.json)//here response json. }; var fnfailure = function response_functionname(response) { alfresco.util.popupmanager.displaymessage({text:"failure"}); }; alfresco.util.ajax.jsonget( { url: alfresco.constants.proxy_uri + "repository_webscript_url", successcallback: { fn: fnsuccess, scope: }, failurecallback: { fn: fnfailure, scope: } });
Comments
Post a Comment