Using DataTables Editor with Node.js
Using DataTables Editor with Node.js
Hi,
This may be a stupid question, but I'm trying to use node/express to process data coming from a DataTables Editor. I'm having trouble, however, determining exactly what is being sent to my script by the editor.
Normally when handling an HTML form text field (for instance) I'd have the HTML like this:
<input type="text" name="myText" value="some content here"/>
And then, on the Node side I'd get the value like this:
router.post('/edit',function(req,res){
// log the incoming form data to the console
console.log(req.body.myText);
});
The trouble is I have no idea of the attributes of the generated form field in Editor. I have tried using fields.name (seemed logical) from the editor definition, but it returns 'undefined'.
Can someone point me in the right direction please?
Thanks
This question has an accepted answers - jump to answer
Answers
Never mind, I've managed to find out for myself. Thanks for reading anyway.
For anyone else reading this, this page documents the data Editor sends to the server-side. You can also use
ajax.data
to modify the data sent, including sending it as JSON.Allan