Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Posting data to xsjs not working

Hello all

I am trying to send a data load from UI (SAPUI5) to the backend (xsjs).

Actually trying to use this example: Transferring complex structured data from UI to XSJS - POSTing JSON

But its not working!

Here my code:

new sap.m.Button('databutton',{

     text: "send data!",


          $.post( "/services/test.xsjs",

                            { JSON_DATA: {"Name": "Test"} }







I can see the button but when I click it, nothing happens!

The backend looks like this:

var JSONString = $.request.parameters.get("JSON_DATA");

var JSONObj = JSON.parse(JSONString);

$.response.status = $.net.http.OK;


Where is the problem?

Greetings, Jan

Former Member

yes you must do the JSON.stringify function here.

it works because of the way serialization works.. by doing this operation you are serializing the data and thats how the xsjs service expects it (serialized)

alternatively to POST, if you could use a get, then you could pass simple text on the url.. but again this would be a different HTTP method which technically is used for a different reason (read data)

hope this is clear

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question