I have PHP loop that loops through a bunch of user IDs.
<?php while ($row = mysql_fetch_assoc($result)) : ?>
<?php $id = $row['id'];
<td width="90px" class="resultsDisplay"><a href=userdetail.php?id=<?php echo $id ?>> <?php echo $row['Username']; ?></a></td>
I would like to replace the HTML link there with an AJAX call to load that page in a particular DIV. The problem I'm having with the code below is that after a link is clicked if continues passing the rest of the user IDs for the loop. So, I click on a link, and it begins cycling through all of the user IDs in the database, loading about 70 pages in a row.
jQuery(document).ready(function(){
$(".resultsDisplay").click(function() {
$.ajax({
url: "userdetail.php?id=<?php echo $id ?>",
success: function(msg){
$("#results").html(msg);
}
});
});