深入extjs与php参数交互的详解
程序员文章站
2022-04-24 21:29:49
复制代码 代码如下: helloworld
<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);
?>
复制代码 代码如下:
<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);
?>
上一篇: 8GB普及了这么多年:是时候全民上16GB内存了?
下一篇: 关于js与php互相传值的介绍