Alfresco share which provide collaboration platform and User Interface to manage repository is built using Spring Surf framework. Spring surf supports usage of widgets extensively within its user interface. Widgets are nothing but small components which you can include inside page to show or manipulate contents from repository. These widgets you can create using YUI or JQuery.
We normally require dealing with two types of webscripts while working with alfresco share which are data and presentation webscripts. Presentation webscript used for rendering user interface whereas data webscript fetches data from alfresco repository. Now we need to call data webscripts from supporting client side webscript according to component structure of alfresco share widgets. So, here is how you can call those webscripts from your client side javascripts.
GET Webscript Call
this.register1= function(){ Alfresco.util.Ajax.jsonGet({ url: Alfresco.constants.PROXY_URI + "/sample/mygetwebscriot?param1="+value1, successCallback: { fn: this.successcallBack, }, failureCallback: { fn: function () { }, } }); };
This is how you can call Get webscript within your alfresco share client side javascript.
POST Webscript Call
Alfresco.util.Ajax.jsonPost( { url: Alfresco.constants.PROXY_URI + "sample/mypostwebscript", dataObj:this.recipeForm.getFormData(), successCallback: { fn: function(res){ alert("success"); alert(res.responseText); }, scope: this }, failureCallback: { fn: function(response) { // Display error message and reload Alfresco.util.PopupManager.displayPrompt( { title: Alfresco.util.message("message.failure", this.name), text: "search failed" }); }, scope: this } }); },
You can replace urls with your webscripts url in above example. In case of post “dataObj” parameter specify the content body which is to be passed during call and within that you can pass your parameters.
Above two are alfresco Utils API which can be used for ajax calls within Alfresco javascript. All connections related things taken care internally by those apis.
Hope this makes things little bit easier for you because while working with alfresco share user interface you will defiantly comes across this requirement and I am certain this comes handy at that time.
Looking for quality Alfresco Web Hosting? Look no further than Arvixe Web Hosting!