Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@soiqualang
Created August 25, 2017 03:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soiqualang/60091c634f18cb76b415f38e43b57087 to your computer and use it in GitHub Desktop.
Save soiqualang/60091c634f18cb76b415f38e43b57087 to your computer and use it in GitHub Desktop.
Service để Ajax gọi tới get data
//get URL cua file hien tai;
$baseUrl = $_SERVER['PHP_SELF'];
//kiem tra thong tin request den
if (isset($_POST['getMember']) && $_POST['getMember'] == 'view')
{
//wating 1s truoc khi thuc thi
sleep(1);
//tao mang member
$member = array('username' => 'phucvh'
,'password' => '123456'
,'email' => 'ahoangphuc@gmail.com');
//dung ham json_encode de chuyen mang $member thanh chuoi JSON
echo json_encode($member);
//ket thuc tra ve du lieu va stop khong cho chay tiep
die;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment