Reputation: 582
I tried to find out if there is really no way with JSONModel loaddata to do a HTTP post adding data (string/binary) to the http body.
While reading the docs (https://openui5.hana.ondemand.com/api/sap.ui.model.json.JSONModel#methods/Summary), testing and searching in stackoverflow/google it seems that there is no way?
I know that I can achieve it with default javascript/jquery ajax. The question is if it's also possible with loaddata method and if I missed something.
Upvotes: 1
Views: 1344
Reputation: 6190
I dug a little deeper and noticed that loadData
calls jQuery.ajax
at some point.
So I tried the following
const oModel = new JSONModel();
oModel.loadData("https://httpbin.org/post", { key: "value" }, true, "POST");
This was the request body
and the response
Isn't this exactly what you are looking for?
Upvotes: 0