ajax.deleteBody
Allow a DELETE Ajax request to have a body or not.
Please note - this property requires the Editor extension for DataTables.
Description
When using a REST interface you might come across the case whereby your HTTP server does not process information that is sent in the request body (more commonly known as "POST parameters"). The HTTP specification says that the DELETE request may have a body, but that also in turn infers that it may not, and different implementations do it different ways.
Editor defaults to the common denominator and all DELETE requests will have their parameters sent as part of the query string. However, this behaviour can be controlled through the use of this parameter, which, when set to false, will cause the Ajax request to retain its body parameters.
Type
boolean
false: The DELETE request may have a body that contains the parameters submittedtrue: The DELETE request will not have a body and all parameters will be submitted in the query string.
Default
- Value:
true
The request is not allowed to have a body, and all parameter will be submitted in the query string.
Example
Allow the DELETE request to submit parameters in the request body.:
var editor = new DataTable.Editor({
ajax: {
create: {
type: 'POST',
url: '/api/create'
},
edit: {
type: 'PUT',
url: '/api/edit/_id_'
},
remove: {
type: 'DELETE',
url: '/api/remove/_id_',
deleteBody: false
}
},
table: '#myTable'
});Related
The following options are directly related and may also be useful in your application development.