HOME
DOMAIN
WEB HOST
AUTO Site
VPS SERVER
CLOUD HOST
SERVER
HK HOST
AGENT
SERVICE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.111cn.net/1999/xhtml"> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <head> <script type="text/javascript"> function showUser(str){ if(window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else{ // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState==4 && xmlhttp.status==200){ document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("POST","ajax.php",true); xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8;"); //开源代码phpfensi.com xmlhttp.send('q='+str); } </script> </head> <body> <form method="post"> ajax的POST<input name="submit" type="submit" onclick="showUser(28);return false;" value="查询"/> </form> <form action="ajax.php" method="post"> 真正的POST<input name="q" type="submit" value="28"/> </form> <br /> <div id="txtHint"><b>Person info will be listed here.</b></div> </body> </html> php 代码 <?php header('Content-Type:text/html;charset=utf-8;'); echo "POST数据: ".implode('',file('php://input')); echo "<br>POST[q] ".$_POST['q']."<br>"; print_r($_POST); ?>