cancel
Showing results for 
Search instead for 
Did you mean: 

New page with button

guiguik
Champ in-the-making
Champ in-the-making
Hi guys.
As a new commer in alfresco I face up a little problem.

I tried to create a simple page (test page) and add a button in this page (It works).
In alfresco I create a webService (It works too).

But now, I simply want to connect the onclick event of my button and my webservice.
If I call my webservice in my serverside js (onLoad for exemple) it works fine, but I don't know how connect it to the connect it on the onclick?
1 REPLY 1

lementree
Champ on-the-rise
Champ on-the-rise
Hi,

If you want to redirect to that url you can simply use <strong>window.location.href=</strong>

If you want to read response from the webscript then you need to make ajax request. as follows.

Alfresco.util.Ajax.jsonRequest(
            {
               url: Alfresco.constants.PROXY_URI + "reva/getconstraints?type="+encodeURIComponent("cr:crInfoList")+"&site=config&property="+encodeURIComponent("{http://www.revasolutions.com/model/content/1.0}crlistDocumentType"),
               method: "GET",
               successCallback:
               {
                  fn: function success(res){
               var responseJson = res.json;
               var itemsList = responseJson.values;
               var dtypeElem = Dom.get(this.pickerId + "-docType");
               if(dtypeElem!=null){
                  dtypeElem.options.length=0;
                  //setting first element blank
                  dtypeElem.options[0] = new Option("","", false, true);
                  for ( var i = 0 ; i < itemsList.length ; i ++ )
                  {
                   dtypeElem.options[i+1] = new Option(itemsList[i], itemsList[i], false, false);
                  }
               }
              },
                  scope: this
               },
               failureCallback:
               {
                  fn:  function success(res){},
                  scope: this
               }
            });