.dataset jquery code example
Example 1: jquery data attribute
<a data-number="123">link</a>
$(this).attr("data-number")
$(this).data("number")
Example 2: simple return data jquery
<?php
include "config.php";
$return_arr = array();
$query = "SELECT * FROM users ORDER BY NAME";
$result = mysqli_query($con,$query);
while($row = mysqli_fetch_array($result)){
$id = $row['id'];
$username = $row['username'];
$name = $row['name'];
$email = $row['email'];
$return_arr[] = array("id" => $id,
"username" => $username,
"name" => $name,
"email" => $email);
}
echo json_encode($return_arr);