Hi,
I'm using Oracle JET Version - 3.2.0
I'm new to the Javascript space. I'm working on implementing the CRUD pattern using Oracle JET and Java based REST API.
I'm trying to update the data in UI and invoke the REST PUT method, but not able to pass the JSON object.
Here is my REST API:
@PUT
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public void edit(TelephoneNumber entity) {
super.edit((TelephoneNumber) entity);
}
Here is my Javascript code:
self.update = function(data)
{
var currentRow = $("#table").ojTable("option", "currentRow");
if (currentRow !== null) {
var collection = data.TNCol();
var model = collection.get(currentRow['rowKey']);
var recordAttrs = {Description: model.get('Description')};
$.ajax({
type: "PUT",
url: testURL = self.serviceURL,
data: JSON.stringify(recordAttrs),
contentType: "application/json",
success: function (data, textStatus, xhr) {
console.log(data);
},
error: function (xhr) {
alert(xhr.responseText);
}
});
}
};
Any inputs would be helpful.
Regards
Ravi