深入extjs与php参数交互的详解
(编辑:jimmy 日期: 2024/11/19 浏览:3 次 )
复制代码 代码如下:
<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="/UploadFiles/2021-04-02/bootstrap.js"> <script type="text/javascript" src="/UploadFiles/2021-04-02/ext-lang-zh_CN.js"> <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);
?>
<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="/UploadFiles/2021-04-02/bootstrap.js"> <script type="text/javascript" src="/UploadFiles/2021-04-02/ext-lang-zh_CN.js"> <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);
?>
下一篇:解析centos中Apache、php、mysql 默认安装路径