I am trying to alert out individual id of every user on the user link click in html. So, every user is being fetched from the database and displayed on the page as a link. Also, since they have a unique email id, I am trying to alert out their emails when that user link is clicked. My issue is whenever I click on the first one, it alerts out the email, but the second, third or so on, on clicking does not pop up any alert.
Here is a snippet of the code :
<strong><a href="#" id="post_user" name="post_user" class="<?php echo $messagePost_Email; ?>"><?php echo $messagePost_FirstName.' '.$messagePost_LastName;?></a></strong>
Jquery
<script type="text/javascript">
$(function(){
$("#post_user").click(function(){
var element = $(this);
var emailID = element.attr("class");
var info = "emailID="+emailID;
alert(info);
$.ajax({
tpye : "POST",
url : "navigate.php",
data: info,
success : function(){
}
})
})
})
</script>
Any suggestions would be of great help since I am not able to figure out the root cause of this behaviour.