ajax在同一个页面获取Post的数据

来源:互联网 发布:ip摄像头集中软件 编辑:程序博客网 时间:2024/04/27 02:00
<?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>

0 0
原创粉丝点击