只是试图制作一个非常简单的 AJAX,但什么也没有。谢谢!
<script>
function update()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
var str='test';
xmlhttp.open("GET","localhost/userupdate.php?q="+str,true);
xmlhttp.send();
}
</script>
和 php 页面 localhost/userupdate.php (WAMP)
<?php
$q=$_GET["q"];
echo $q;
?>