Skip to Content

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

Read body in XSJS

Dear Experts,

I post a request in fiori with following code:

addJob: function () {

  var oJsonData = {

  "JOBID":"JB9006",

  "DESCRIPTION":"AddJob9006",

  "DEPARTMENT":"AddDep.",

  "VALID_TILL":Date.now()

  };

  $.ajax({

  url:this.getView().getModel().sServiceUrl.substr(0,35)+"/update.xsjs?$mode=ins",

  type:'POST',

  contentType:'application/json',

  data: JSON.stringify(oJsonData),

  dataType:'json',

  success: function(){alert("Update Success!");}

  });

  }

But in update.xsjs, I can't read body with follow command:

var sData = $.request.body.asString();

It's always undefined.

How to read body of the request?

By the ways, develop environment of xsjs is HCP Trial.

Thanks & Regards.

Chad

Tags:

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question