代碼如下:
<html>
<head>
<title>HelloWorld</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../ext-4.0.7-gpl/resources/css/ext-all.css" >
<script type="text/javascript" src="../../ext-4.0.7-gpl/bootstrap.js"></script>
<script type="text/javascript" src="../../ext-4.0.7-gpl/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
var requestConfig = {
url:'loginServer.php', //請求的服務器地址
params:{userName:'lowkey', password:'zq19890319'}, //請求參數
method : "post",
callback:function(options, success, response) {
var msg=["請求是否成功:", success, "n",
"服務器返回值:", response.responseText];
Ext.Msg.alert("提示", response.responseText);
}
}
Ext.Ajax.request(requestConfig);
});
</script>
</head>
<body>
</body>
</html>
復制代碼代碼如下:
<?php
$userName = $_POST["userName"];
$password = $_POST["password"];
$msg = "";
if($userName=="lowkey" && $password=="zq19890319") {
$msg = "登陸成功";
} else {
$msg = "登陸失敗";
}
echo($msg);
?>