<meta charset="utf-8" & gt;
<script>
The function test () {
//////////////////////////////////return XMLHTTP responseText and output
Var y=loadXMLDoc ();
Alert (y);
//////////////////////////////////output XMLHTTP responseText
Document. The getElementById (" myDiv "). The innerHTML=y;
}
The function loadXMLDoc ()
{
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)
{
//the document. The getElementById (" myDiv "). The innerHTML=XMLHTTP. The responseText;
//////////////////output XMLHTTP responseText
Alert (XMLHTTP. The responseText);
Xx=XMLHTTP var. The responseText;
//////////////////return XMLHTTP responseText
The return of xx;
}
}
XMLHTTP. Open (" POST ", "ajax_test_return_value. PHP", true);
XMLHTTP. The send ();
}
</script>
<body>