postSubmit
Submit complete event (before the returned data is processed by Editor).
Please note - this property requires the Editor extension for DataTables.
Description
Post-submit event for the form, fired immediately after the data has been loaded by the Ajax call, allowing modification or any other interception of the data returned form the server.
This event is called for both the success and error conditions - i.e. regardless of what the server returned, this event will be triggered.
If you wish to manipulate the JSON that Editor will use as the data returned by the server, please modify the first argument (json) that is passed into the event handler, rather than trying to modify the responseJSON or responseText parameters of the XHR object, which Editor will abstract out the difference between.
Important: If the server returns any data that is not valid JSON, Editor will fall into its error state and null will be passed in as the json parameter. If you want to manipulate this error response into a successful response, you need to use a custom complete function on the ajax object that will mutate the responseJSON/responseText (depending on your version of jQuery) parameters of the XHR object to contain valid JSON.
Event naming / backwards compatibility note
Prior to Editor 1.3, events were prefixed with the string on and this event was called onPostSubmit. That event name can still be used, and will function exactly the same way as the event documented here. The new name is used for simplicity and coherence with the event naming conventions in DataTables.
Type
function( e, json, data, action, xhr )
Parameters:
| Name | Type | Optional | |
|---|---|---|---|
| 1 | e | No | |
Event object | |||
| 2 | json|null | No | |
JSON data returned from the server. | |||
| 3 | data | No | |
The data object that was submitted to the server | |||
| 4 | action | No | |
The action type for this submit - | |||
| 5 | xhr | No | |
The jQuery XHR object that was used for the request. This allows the object itself to be manipulates before Editor makes use of it. If there is no XHR object (e.g. local table editing, or you provide your own | |||