Skip to Content
0
Jan 21, 2014 at 08:32 AM

Calling XSJS from UIF with method POST and Json

89 Views

Hi,

I would like to call HANA XSJS service from UI5 using the method POST to send some JSON data message body.

I did it like this:

var aUrl = "/url/service.xsjs";

var oButton = new sap.ui.commons.Button({

text: "Create",

press: function(oEvent){

jQuery.ajax({

url : aUrl,

method : 'POST',

dataType : 'json',

data : jsonData,

success : function(result){alert('OK');},

error : function(jqXHR, textStatus, errorThrown){alert('NOT OK');}});

}

});

The service is called but I don't know how to aceess the data in the xsjs code. I tried

var json = $.request.body; but that did not work.

Any idea what I do wrong? Or an example?

Thanks and Regards,

Alex