I am trying to get the specific username information from the links below. When one of the links is clicked, the username information should be kept in the var username. However, it is not working. Any help is very welcome.
<!doctype html>
<?php
$theUsernameDaniel="danielcajueiro";
$theUsernameMarcelo="marcelopapini";
?>
<html>
<head>
<meta charset="utf-8" />
<title>ControllingHiperlinks</title>
<script src="http://code.jquery.com/jquery-1.4.1.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$("a.peoplePage").click(function(event) {
var username=$(this).data("username");
alert(username);
event.preventDefault();
});
});
</script>
</head>
<body>
<!-- Updated after the answer below of @Pranav-C-Balan -->
<a class="peoplePage" data-username="<?php echo $theUsernameDaniel ?>" href=""> Daniel Cajueiro</a>
<a class="peoplePage" data-username="<?php echo $theUsernameMarcelo ?>" href="">Marcelo Cajueiro</a>
</body>
</html>