Skip to Content
0
Dec 18, 2018 at 09:38 AM

How to ready body output from xsjslib in UI5?

240 Views

Hi All,

I'm trying to execute a POST operation using xsjslib exit. In the xsjslib file, I have written my logic and at the end I'm also setting a output in the body as below

$.response.contentType = "application/json";
$.response.contentType = "text/plain";
$.response.setBody("Done");
}

Also, the controller.js file looks like below

var body = JSON.parse($.request.body.asString());
			oThis.insertService.create("/user", userdata, {
				success: function(oData, result) {
					console.log(body);
				},
				error: function(oError) {
					console.log(oError);
				}
			});
		},

Here my intention is to read the output set in the $.response.setBody("Done") in the console log. I have tried doing this using var body, but I'm not sure if this is the correct apporoach.

Pls help