php教程 ajax XMLHttpRequest POST实例代码 <br />function showUser(str){<br /> if(window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari<br /> xmlhttp=new XMLHttpRequest();<br /> }else{ // code for IE6, IE5<br /> xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");<br /> }<br /> xmlhttp.onreadystatechange=function(){<br /> if(xmlhttp.readyState==4 && xmlhttp.status==200){<br /> document.getElementById("txtHint").innerHTML=xmlhttp.responseText;<br /> }<br /> }<br /> xmlhttp.open("POST","ajax.php",true);<br /> xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8;");<br /> xmlhttp.send('q='+str);<br />}<br /> ajax的POST 真正的POST Person info will be listed here. php 代码header('Content-Type:text/html;charset=utf-8;');echo "POST数据: ".implode('',file('php://input'));echo "POST[q] ".$_POST['q']."";print_r($_POST);?>