Send Json data on form submit and read through in Repository webscript
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2014 09:50 AM
When i do custom form (runtime form) submit, i make Ajax call to Repository webscript. I want to know how to pass Json data to the webscript. Also, I want to know how to parse Json data at controller javascript.
I also noticed, all root scoped objects are not available at controller javascript. I was not able to access document, script, etc. Because of that, i could not check the content type of the request.
Please help.
I also noticed, all root scoped objects are not available at controller javascript. I was not able to access document, script, etc. Because of that, i could not check the content type of the request.
Please help.
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2014 09:47 AM
Earlier i made Ajax call as Alfresco.util.Ajax.request. I changed it to Alfresco.util.Ajax.jsonPost, now i observe that the request body content type is application/json. But there is no data in the "Request payload".
I found there is something called "dataObj:", which i need to send while making Ajax call. Basically the dataobj will have json data, which is nothing but form input values. I don`t know how to read runtime form values and set in dataobj. Please help.
PS: Attached is the javascript code to create runtime form and to make Ajax call.
I found there is something called "dataObj:", which i need to send while making Ajax call. Basically the dataobj will have json data, which is nothing but form input values. I don`t know how to read runtime form values and set in dataobj. Please help.
PS: Attached is the javascript code to create runtime form and to make Ajax call.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2014 09:33 AM
Hello,
Did you find a solution? I have the same problem.
Thank you!
Did you find a solution? I have the same problem.
Thank you!
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2014 11:50 PM
Hi,
Can you please upload your javascript and mention in which control values you're not able to read ?
I used lot of custom share forms on Share, but I didn't faced this kind of problem.
Can you please upload your javascript and mention in which control values you're not able to read ?
I used lot of custom share forms on Share, but I didn't faced this kind of problem.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2014 08:37 AM
Hi,
You need to stringify the json and send it as data to post request sample as below for posting favorites
You need to stringify the json and send it as data to post request sample as below for posting favorites
var url = "/alfresco/service/api/people/" +username + "/preferences"; var dataObj = { "org": {"alfresco":{"share": {"documents": {"favourites":favourites }}}} }; var data = JSON.stringify(dataObj); $.ajax({ type: "POST", url: url, async: false, data: data, contentType: "application/json", complete: function (data) { } });
