echo '<div class="jumbotron">';
while ($user = $usr->fetch()) {
echo "<div><a href='#'" .
"data-id='" . $user['id'] . "'>" .
htmlspecialchars($user['name']) .
"</a></div>";
$(".jumbotron > div > a").on('click', () => {
var url = "user.php?id=" + $(this).data('id');
$.ajax({
url: encodeURI(url)
}).done((data) => {
$('#info').html(data).removeClass('hidden');
});
});
Asked
Active
Viewed 16 times
0
$(this).data('id')использовать$(this).attr('data-id');– De.Minov Feb 28 '20 at 16:59...on('click', function() {...– Feb 28 '20 at 17:07