AnsweredAssumed Answered

How can i return a value from AJAX in Alfresco

Question asked by skumar.us on Mar 3, 2015
Latest reply on Mar 20, 2015 by skumar.us
Is it possible to return value from AJAX in alfresco.
I know it is possible outside alfresco by using callback ,which does not work here.is there any possible workaround ?I am able to get the value inside ajax call in the line "alert("getting value==>"docNodeRef);".But getting the value as "undefined" outside if it.which is expected since it is an asynchronous call.I am looking for some workaround to return the value from AJAX or can i make it synchronous,how?

loadNodeRef: function Tasklist_loadNodeRef(taskId)
      {
     
      Alfresco.util.Ajax.request(
      {
         url: Alfresco.constants.PROXY_URI + "/getNodeRef?taskId="+taskId,
        
         successCallback:
         {

           fn:function(response){
            var docNodeRef= response.serverResponse.responseText;
            
alert("getting value==>"docNodeRef);

   

            },
           scope: this
         },
         failureMessage: this.msg("message.failure"),
         scope: this,
         execScripts: true
      });   
},

Outcomes