标签:close pre open dea param windows data 判断 ted
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="content-type" content=‘text/html;charset=utf-8‘> 5 <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js" ></script> 6 <title></title> 7 </head> 8 <body> 9 <script> 10 $.post(‘./jquery_post.php‘,{os:‘windows‘,code:‘php‘},function(data){ 11 alert(data.param1 + ‘------‘ + data.param2); 12 },‘json‘); 13 </script> 14 <h1 id=‘h1‘></h1> 15 </body> 16 </html>
1 <?php 2 $os=$_POST[‘os‘]; 3 $code=$_POST[‘code‘]; 4 echo json_encode( 5 array( 6 ‘param1‘=>$os, 7 ‘param2‘=>$code 8 ) 9 ); 10 ?>
1 //判断是否AJAX请求 2 isset($_SERVER[‘HTTP_X_REQUESTED_WITH‘]
标签:close pre open dea param windows data 判断 ted
原文地址:https://www.cnblogs.com/t-young1201/p/10231123.html