simple return data jquery
$(document).ready(function(){
$.ajax({
url: 'ajaxfile.php',
type: 'get',
dataType: 'JSON',
success: function(response){
var len = response.length;
for(var i=0; i<len; i++){
var id = response[i].id;
var username = response[i].username;
var name = response[i].name;
var email = response[i].email;
var tr_str = "<tr>" +
"<td align='center'>" + (i+1) + "</td>" +
"<td align='center'>" + username + "</td>" +
"<td align='center'>" + name + "</td>" +
"<td align='center'>" + email + "</td>" +
"</tr>";
$("#userTable tbody").append(tr_str);
}
}
});
});<?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);
}
// Encoding array in JSON format
echo json_encode($return_arr);
Also in JavaScript:
- space between react native
- remove element json javascript
- HOW TO SPLIT AN ARRAY JAVASCRIPT
- update photoURL firebase
- javascript randomly shuffle array
- chartjs bar chart hover color
- string charAt array js
- Javascript string compression
- json-server localhost
- how to write img jsx
- jquery get next element
- smooth scrolll to id js
- javascript array filter elements greater than
- nodemailer
- ERROR in ./node_modules/tns-core-modules/ui/core/view/view.js Module not found: Error: Can't resolve '@nativescript/core/ui/core/view/view' in '/home/deepali/projects/supersquad-client/node_modules/tns-core-modules/ui/core/view'
- capitalize
- nest winston
- kendo grid add line javascript
- set css variable from javascript
- vue js cdn
- submitting login and sign up forms using AJAX
- javascript countdown 1 minute
- req.params.id in nodejs
- boble sorting javascript