Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Posting data to xsjs not working

$
0
0

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!",      press:function(){          $.post( "/services/test.xsjs",                             { JSON_DATA: {"Name": "Test"} }           )          .done(function(data){               alert(data);           });      }
 });

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;
$.response.setBody(JSONObj.Name);

Where is the problem?

 

Greetings, Jan


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>