sending list_users in json
This commit is contained in:
parent
fa48f58cf1
commit
b1f345394e
@ -20,7 +20,13 @@
|
||||
url: "./res/forum/api/list_users.php",
|
||||
success: function(result)
|
||||
{
|
||||
$("#left_panel").html(result);
|
||||
let users = "";
|
||||
for (let i in result.users)
|
||||
{
|
||||
users += "<div class=\"output\">" + result.users[i] + "</div>";
|
||||
}
|
||||
|
||||
$("#left_panel").html(users);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -18,7 +18,12 @@ if ($out -> num_rows != 1)
|
||||
|
||||
$out = $database -> query("SELECT username FROM user ORDER BY id ASC");
|
||||
|
||||
$output = array();
|
||||
|
||||
while ($res = $out -> fetch_assoc())
|
||||
{
|
||||
echo "<div class=\"output\">" . $res["username"] . "</div>";
|
||||
}
|
||||
array_push($output, $res["username"]);
|
||||
}
|
||||
|
||||
header('Content-type: application/json');
|
||||
echo json_encode(["users" => $output]);
|
Loading…
x
Reference in New Issue
Block a user