I have modal with a table of labels and checkboxes. For saving the values I want to do an Ajax request and send the data to the server as an array. The rows of my table have an attribute data-teilnehmerId
. Now I want to store the values of my modal so that in every I can access them like this:
teilnehmer[teilnehmerId][classOfTheCheckbox]
For this reason I wrote the following code:
$('.checkBoxesClass').each(function () {
teilnehmer[$(this).parent().parent().prop('data-teilnehmerId')]['checkBoxesClass'] = $(this).prop('checked');
});
But now I got an error which sais that $(this).parent().parent().prop('data-teilnehmerId')
is not defined. When I let it log on my console I get the right object but not it's property.
Does anyone know why it's like this and how to solve it/has an better solution?
Note: the classes of the checkboxe are predefined so I don't have to get them with JQuery
Aucun commentaire:
Enregistrer un commentaire