retreave data from selected rows and send this data in Json to the server
retreave data from selected rows and send this data in Json to the server
guillaume.lheureux.son@gmail.com
Posts: 15Questions: 6Answers: 1
Hello!
I have a " json is not defined" from my browser when I click on the button bind to the function createSoftwareUpdateScript...
I want to retreave the data from selected rows and send this data in Json to the server.
function createSoftwareUpdateScript() {
var table = $('#myTable').DataTable();
var selectedData = table.rows( { selected: true } ).data().toArray();
$.ajax({
type: 'POST',
url: 'http://localhost:8080//RedlogServer3/Servlet',
dataType: 'json',
data: {json: JSON.stringify(selectedData)},
success: function (data) {
alert('success insert' + json);
}
});
};
This discussion has been closed.
Answers
In your
success
function you are passing the parameterdata
but using the variablejson
. Maybe you meant somethign like this:Kevin
with my first code I achieved well to retrieve all the data. But what I want now is to retrieve just the selected one..
My first code:
Compare to this code (that is working) I just add "{ selected: true }" that I thaught would filter the data with only the selected rows... But it's not working
will give you an array of the data from the rows which have been selected with the Select extension. If that isn't working for you, we'd need a link to an example showing the issue.
Allan