index.html内容如下

User Login

  • Username
  • Password

index.php内容如下

header("Content-type:text/html;charset=utf-8");

$username = $_GET['username'];

$password = $_GET['password'];


$res = array('code'=>1,'msg'=>'','data'=>[]);

if($username == 'ceshi' && $password == '123456'){

    $res['msg'] = "success";

}else{

$res['code'] = 0;

$res['msg'] = 'fail';

}

echo json_encode($res);

$.ajax()应用_第1张图片