<meta charset="utf-8" & gt;
<script>
The function myFunction () {
//alert (" enter the function ");
//the document. The getElementById (" shuchu "). The innerHTML="Hello World";
Var form=document. GetElementById (' form1 ');
Var formdata=https://bbs.csdn.net/topics/new formdata (form);
Var XMLHTTP;
If (window. The XMLHttpRequest)
{
//IE7 +, Firefox, Chrome, Opera, Safari execute code
XMLHTTP=new XMLHttpRequest ();
}
The else
{
//IE6, IE5 browser code execution
XMLHTTP=new ActiveXObject (" Microsoft. XMLHTTP ");
}
XMLHTTP. Onreadystatechange=function ()
{
If (XMLHTTP. ReadyState==4 & amp; & XMLHTTP. Status==200)
{
//document. GetElementById (" shuchu "). The innerHTML=XMLHTTP. The responseText;
Alert (XMLHTTP. The responseText);
}
}
XMLHTTP. Open (" POST ", "test_ajax_formdata. PHP", true);
XMLHTTP. Send (formdata);
}
</script>
<body>
B: & lt; Input type="text" name="lastname" & gt;