dataTables form submit with pagination cant get all data?
dataTables form submit with pagination cant get all data?
scs
Posts: 2Questions: 1Answers: 0
I have a form with dataTables, once submitted it will get all the data and save it into the database. but since dataTables pagination is true, currently it is only saving the data that are shown and the rest are not saved.
$('#uploadClicked').click(function () {
var table = $('#dataTable-ageGroup').DataTable();
var data = table.$('input, select').serialize();
var json = JSON.stringify(data);
document.getElementById('json').setAttribute('value', json);
alert("The following data would have been submitted to the server:
\n\n" + data);
document.getElementById('UploadDb').submit(); return false;});
tried to do this but the result is in a form that i dont understand...
location=Barangay+1&ageGroup=All+Ages&bothSexes=2197&male=1086&female=1111&location=Barangay+1&ageGroup=Under+1&bothSexes=42&male=17&female=25&location=Barangay+1&ageGroup=1+-+4&bothSexes=169&male=88&....
if this is the only way without using ajax, how can i translate this data into json form?? or any another way where i can turn that data into an object
This discussion has been closed.
Answers
my initial solutions is to create an
hidden
input were it will save theserialize
data, then in theservlet
I will create/turn thatdata
into anobject
. The problem is I dont know what kind of data is that or how will I turn it intojson data
.I am just a beginner in using
JSON
.