From your 'share-side' js, you can call repository web-script using 'remote' root-scoped object to connect to alfresco like this…
var connector = remote.connect("alfresco");
var result = connector.get("/yourCustomURI/or/OOTB-URI");
or you can directly use 'remote.call' like
var result = remote.call("/yourCustomURI/or/OOTB-URI");
And from client-side js, you can call the same using Ajax request like this..
Alfresco.util.Ajax.request({
url: "/yourCustomURI/or/OOTB-URI"
, method: "GET"
, successCallback: {
fn: this.onSuccess
, scope: this
}
, failureCallback: {
fn: this.onFailure
, scope: this
}
});
Hope it is helpful.