ajax在同一个页面获取Post的数据
2014-11-21 16:06
316 查看
<?php
if($_POST['act'] == 'get'){
$action = 2;
if($action == 2){
$is_gz = 0;
}else{
$is_gz = 1;
}
echo $is_gz;
exit;
}
?>
<html>
<head>
<script src="jquery-1.11.1.min.js" type="text/javascript"></script>
</head>
<body>
<script>
$.post(location.href,{act:'get',action:2},function(d,s){
//alert(22);
if(d == 0){
alert(11);
}
});
</script>
</body>
</html>
if($_POST['act'] == 'get'){
$action = 2;
if($action == 2){
$is_gz = 0;
}else{
$is_gz = 1;
}
echo $is_gz;
exit;
}
?>
<html>
<head>
<script src="jquery-1.11.1.min.js" type="text/javascript"></script>
</head>
<body>
<script>
$.post(location.href,{act:'get',action:2},function(d,s){
//alert(22);
if(d == 0){
alert(11);
}
});
</script>
</body>
</html>
相关文章推荐
- 对于web api 从页面post数据到web api,如果用ajax,则可以成功上传到服务器,需要一个类来存储那些变量
- 返回到前一个页面时显示前一个页面中ajax获取的数据
- 笔记-返回到前一个页面时显示前一个页面中ajax获取的数据
- file_get_contents获取一个页面并发送 POST 数据
- GridView中 对数据编辑打开一个新页面 & 动态添加控件并获取其值
- 如何用asp 获取post的页面的数据( 最基本的POST格式,便于学习MVC)
- ajax xmlhttprequest使用post传参数并向后台获取数据
- 推荐一个创新的东西,OPS[将表单页面数据XML化,与AJAX完美结合起来,有创意!]
- ajax post data 获取不到数据,注意content-type的设置post/get
- c++ builder2010 indy控件idhttp, post页面获取数据(要注意编码的问题,双方都使用UTF-8最好)
- 页面单击按钮弹出modaldialog然后调用ajax处理程序获取数据,给父级页面控件赋值
- 获取远程的字符串(请求一个URL, 返回这个请求页面的页面数据)
- ci检测是ajax还是页面post提交数据的方法
- ThinkPHP定时ajax获取后台数据,使用javascript动态修改前端页面的表格来显示数据
- ajax post data 获取不到数据,注意 content-type的设置 、post/get
- 基于对象的JavaScript实现无刷新页面发送和获取数据Ajax.js
- Ajax命名空间一个获取指定的页面元素的快捷方式——$get()
- AJAX通过post提交数据,并获取XML格式返回结果
- c#模拟表单POST数据,并获取跳转之后的页面
- 通过post方法远程获取一个页面