如何在共享网络脚本js文件中获取数据网络脚本的响应

how to get respose of data webscript in share webscript js file

我在露天一侧有一个数据网络脚本,return json 响应。

我希望共享网络脚本中的此 json 响应显示共享上的 json 数据。

以下是我写在getLocation.get.js文件@share中的代码。

      var result1 = new Array();
      var connector = remote.connect("alfresco");
      var data = connector.get("/com/portfolio/ds/getlocation");

        // create json object from data
      if(data.status == 200){
      var result = jsonUtils.toJSONString(eval(data.response));
        model.docprop = result ;
         }else{
         model.docprop = "Failed";
        }

以下是露天的输出

     { 
        "subgroups": [
        {
        "name": "grp_pf_india_user" ,
            "label": "INDIA"
         }, 
    {
      "name": "grp_pf_israil_user" ,
      "label": "ISRAIL"
     }, 
    {
      "name": "grp_pf_usa_user" ,
      "label": "USA"
      } 
     ]
     }

使用此代码通过概念或 RMI 从共享端调用 repo webscripts。 (Alfresco.constants.PROXY_URI) = (http://host:port/share/proxy/alfresco/)

var xurl=Alfresco.constants.PROXY_URI+"HR-webscripts/createHRDocument/"+JSON.stringify(o);
    //alert(xurl);
    var request = $.ajax({
        url: xurl ,
        type: "POST",
        //data: { "groupname" : o},
        beforeSend : function(xhr){
            /*
            Alfresco.util.Ajax & alfresco/core/CoreXhr – will automatically take the token from the cookie and add it as a request header for every request.
            Alfresco.forms.Form – will automatically take the token from the cookie and add it as a url parameter to when submitting an multipart/form-data request.
            (When submitting a form as JSON the Alfresco.util.Ajax will be used internally) 
            */                  
            if (Alfresco.util.CSRFPolicy && Alfresco.util.CSRFPolicy.isFilterEnabled()){    
                xhr.setRequestHeader(Alfresco.util.CSRFPolicy.getHeader(), Alfresco.util.CSRFPolicy.getToken() );
            }
        },
        dataType: "html"
    });

    request.done(function(msg) {
       //alert( "Request OK: " + msg );
      $("#res").html( msg );
    });

    request.fail(function(jqXHR, textStatus) {
      alert( "Request failed: " + textStatus );
    });