I then want to display the users on each course underneath.
I was doing this with Jquery. I'm sure there is a way to do it using PHP but I liked the idea of it loading faster and the drop-down toggle.
The JQuery I have is:
function show_learners(type_ID) {
var type_ID = type_ID;
// send data check
var dataString = 'type_ID=' + type_ID;
//alert (dataString);return false;
$.ajax({
type: "POST",
url: "../php/get_course_users_details.php",
data: dataString,
cache: false,
success: function(html) {
//display message back to user here
var result = html.charAt(0);
var data = html.substring(2);
//if ../php/get_course_users_details.php returned 1/true
if (result = 1) {
var nextid = type_ID + 1;
$('#' + type_ID + ' .rightdd').attr('src', '/kmt/admin/img/dd2-icon.gif');
$(data).insertBefore($('#' + nextid));
var shown = 1;
}
//if ../php/get_course_users_details.php returned 0/false
if (result = 0) {
return false;
}
// Do anything else
}
});
}
function hide_learners(type_ID) {
$('#' + type_ID + ' .bg').hide();
$('#' + type_ID + ' .rightdd').attr('src', '/kmt/admin/img/dd-icon.gif');
var shown = 0;
}
the returned information in variable data is:
<tr id="3" class="bg"> <td class="first style2">- Testing user</td> <td> Hairdressing and Barbering </td> <td>20%</td> <td><img src="img/login-icon.gif" width="16" height="16" alt="View user profile" /></td> <td>09/04/2010</td> </tr>
the page it displays on is:
<table class="listing" cellpadding="0" cellspacing="0">
<tr>
<th class="first" width="177">Users</th>
<th>Course</th>
<th>Progress</th>
<th>Profile</th>
<th class="last">Last Updated</th>
</tr>
<?php do { ?>
<tr id="<?php echo $row_all_course_data['type_ID'];?>">
<td colspan="5" id="<?php echo $row_all_course_data['type_ID'];?>" class="first style1">- <?php echo $row_all_course_data['type_name'];?>'s<img id="<?php echo $row_all_course_data['type_ID'];?>" class="rightdd" src="/kmt/admin/img/dd-icon.gif" width="14" height="14" /></td>
</tr>
<?php } while ($row_all_course_data = mysql_fetch_assoc($all_course_data)); ?>
</table>
Anyone able to help my get the hide_learners function to actually hide the inserted rows. I also need a way to stop show_learners running everytime its clicked.
thanks Will

New Topic/Question
Reply



MultiQuote




|