How to define alfresco webscript url to call from share
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2014 11:53 AM
Hi,
I want to send json data from share client-side javascript to my alfresco webscript defined as com/mycompany/mywebscript.
My code looks like
in share. I don't know how to define url value to my alfresco webscript.
Thanks.
I want to send json data from share client-side javascript to my alfresco webscript defined as com/mycompany/mywebscript.
My code looks like
Alfresco.util.Ajax.request({ url: 'com/mycompany/mywebscript', dataObj: { mode: "test", submitType: "json" },});
in share. I don't know how to define url value to my alfresco webscript.
Thanks.
Labels:
- Labels:
-
Archive
4 REPLIES 4

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2014 01:30 AM
You can call Alfresco webscript with below code with you url:
Alfresco.util.Ajax.request(
{
url: Alfresco.constants.PROXY_URI + {YOUR_ALF_WEBSCRIPT_URL},
method: Alfresco.util.Ajax.GET OR Alfresco.util.Ajax.POST,
dataObj:
{
},
successCallback:
{
fn: this.success, // Success method call
scope: this
},
failureCallback:
{
fn: this.failure, // Failure method call
scope: this
}
});
Hope this helps you.
Alfresco.util.Ajax.request(
{
url: Alfresco.constants.PROXY_URI + {YOUR_ALF_WEBSCRIPT_URL},
method: Alfresco.util.Ajax.GET OR Alfresco.util.Ajax.POST,
dataObj:
{
},
successCallback:
{
fn: this.success, // Success method call
scope: this
},
failureCallback:
{
fn: this.failure, // Failure method call
scope: this
}
});
Hope this helps you.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2014 06:49 AM
Thanks,
This is working. I'm able to send data to my alfresco webscript with this code.
Now how can I get this data in my webscript. In ftl file or in javascript(json) file ?
Thanks.
This is working. I'm able to send data to my alfresco webscript with this code.
Alfresco.util.Ajax.request({ url: Alfresco.constants.PROXY_URI + "com/mycompany/annotation", method: Alfresco.util.Ajax.GET, dataObj: { mode: "test", submitType: "json" },}),
Now how can I get this data in my webscript. In ftl file or in javascript(json) file ?
Thanks.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2014 10:09 AM
Ok. In my fileName.get.html.ftl I can get the json data sent from share client-side javascript file.
Ex:
Guess will be helpful for someone in the future.
Ex:
Data received : ${args.mode}
Guess will be helpful for someone in the future.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2014 12:45 PM
On the assumption all is properly named you should have an object called json available to your recieving webscript and you get things from it using json.get("fieldname");
