I am trying to pass a href value to ajax function, how do i do? my a href is inside while loop. i can pass a href value going to next page, but i want to stay in same page while click on a href.
<?php
$sql ="SELECT * FROM user";
$query =mysqli_query($connection, $sql);
if($query->num_rows>0){
while( $row =$query->fetch_assoc()){
$id =$row['id'];
$fname =$row['fname'];
$first_character = substr($fname, 0, 1);
$lname =$row['lname'];
$last_character =substr($lname, 0, 1);
$pass =$row['password'];
$online=$row['online_offline'];
?>
<a href="index.php?id=<?=$id;?>" class="list-group-item list-group-item-action border-0">
<div class="d-flex align-items-start">
<!-- <img src="https://bootdey.com/img/Content/avatar/avatar3.png"
class="rounded-circle mr-1" alt="Jennifer Chang" width="40" height="40"> -->
<span class="circle"><?=$first_character.$last_character;?></span>
<div class="flex-grow-1 ml-3">
<?=$fname.' '.$lname;?>
<?php if($online =='1'){ ?>
<div class="small"><span class="fas fa-circle chat-online"></span> Online</div>
<?php }else{?>
<div class="small"><span class="fas fa-circle chat-offline"></span> Offline
</div>
<?php } ?>
</div>
</div>
</a>
<?php }}
1条答案
按热度按时间ugmeyewa1#