JQuery getJSON by php

在php中使用JQ的get json


js code

/////php code


  if(isset($_GET['name'])   ){ 
    
 
    $name = $_GET['name'];

    $sql = "select * from members where name = '".$name ."'";    
        $result = mysqli_query($conn, $sql ) or die(mysqli_error($conn));    
      $rows = mysqli_num_rows($result);
      $response = array(); 
      if($rows > 0){    
        $response =array("Y");
      }
 
    echo json_encode($response); //输出的格式必须是json
}

?>