My problem is that the database fields have been badly designed by previous people before me. We are accessing the table rows horizontally.
I am working with PHP and jQuery right now and I am passing data back and forth through AJAX. In PHP I am accessing this array like so:
$attendance['date_lesson_' . $lessonCount]
where lessonCount is a number from 1-10 that is incremented i.e. if
lessonCount = 1 then above would be
I am passing the attendance array through
How do I therefore access this field
data_lesson_ 1 up to 10 in jQuery?
I am trying to do:
var lessonCount = 1; attendance[i].date_lesson_+lessonCount //do some stuff with attendance.date_lesson_ lessonCount++;
It was easy in PHP cause you concatenate strings with the dot
Yes, I know. This is awkward. I agree 100%.
You’ll need to use bracket notation:
attendance['date_lesson_' + lessonCount]