Currently, I have a Datatable set up and I am utilizing the jeditable plugin to make cells editable and update data. However, after editing a cell and hitting enter, when the data is sent back to my URL Rest endpoint (where I simply have a System.out.println statement to view the data), I encounter this error message from Firebug:
"NetworkError: 415 Unsupported Media Type - my rest endpoint url"
The issue lies in the fact that my endpoint expects an Object in JSON format while jeditable is only sending some string parameters. Therefore, I need to wrap it up properly.
Allow me to share my datatable initialization code along with the jeditable setup.
var computerTable = $("#table_computerTable ").dataTable({
"bProcessing": true,
//Other configuration settings
}).makeEditable({
sUpdateURL: getApiUrl() + "cpu/save",
sReadOnlyCellClass: "read_only",
ajaxoptions:{
dataType: "json",
type: 'POST'
}
});
Upon sending the POST request, here is the data I receive (as observed through firebug):
columnId 3
columnName daily
columnPosition 2
id 24
rowId 0
value 50
The goal is to construct an object containing all the necessary data such as ID, Serial, and the new value before sending it back.
Given my limited knowledge of jQuery and JavaScript, I'm unsure about where to begin making this modification. Any guidance or suggestions would be greatly appreciated.