//Javascript
function updateStudentAttendance(event)
  {
    if ($(this).hasClass('here')) {
  $(this).removeClass('here');
  $(this).addClass('absent');
  var schoolId = $(this).children('p').attr('id');
  var studentId = $(this).attr('id');
  var classId = document.getElementById("classId").value;
  postAttendance(studentId, schoolId, classId, 'Absent');
}
function postAttendance(studentId, schoolId, classId, attendanceEvent)
{
  $.post('post_attendance.php', {
  'studentId': studentId,
  'schoolId': schoolId,
  'event': attendanceEvent,
  'classId': classId
}, function(data) {
 // alert(data);
});
}
//php code looks like this:
<?php
    print sprintf('<div id="%s" class="student span2 well well-small %s">
        <input type="hidden" id="classId" name ="classId" value="%s">'
        , $student->getId(), $class, $classId);
    print '<img src="img/userp.png" style="width: 100%; text-align: center;">';
    print sprintf('<p id="%s" style="text-align: center; font-size: 12px;">%s %s'
        , $_GET['schoolId'], $student->getFirstName, $student->getLastSurname());               
    print '</p>';
    print '</div>';
?>
That's the code I'm using which which pulls the information from the id's and I had to add a hidden element to get the classId. I then post it back after it being modified to update the database with the new information. I feel like this is a terribly odd way to do it and would like to have a better solution for passing these variables.
Please let me know a better way to do this. Thanks!