cancel
Showing results for 
Search instead for 
Did you mean: 

POST send and receive json

artonix14
Champ in-the-making
Champ in-the-making
Hello guys i'm trying to send json on klient side and receive json on server side. Only things what im getting is null or undefined, i tried many ways here is the last and most promisng but still not functional. Here is the request from client side:

Alfresco.util.Ajax.request(
                {  
                    url: Alfresco.constants.PROXY_URI + "s/saveForm",
                    method: Alfresco.util.Ajax.POST,
                    requestContentType: "json",
                    dataObj:
                        {
                            site: Alfresco.constants.SITE,                             
                            dataValues: JSON.stringify(formDataArray),
                            submitType: "json"
                        },

                    successCallback:                                                       
                        {  

                            scope: this
                        },
                    failureCallback:
                        {

                            scope: this
                        }, 
                    execScripts: true
                });

Here is how should i receive json:
          var jsonData = json.get("dataValues");

Im getting error that json is undefined but it should be defined. Anybody please tell me what im doing wrong ?
2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator
I suspect your POST web script is missing the "json" part of the name. For example, "saveForm.post.json.js".

Jeff

dhaval_patel_10
Champ in-the-making
Champ in-the-making
try receive post data with

var data = requestbody.content;
var dataj = eval('(' + data + ')');
var dataValues=dataj.dataValues;

hope you will get.