为什么$ _POST从ajax请求中得不到任何东西?

var httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = action;
httpRequest.open('POST','/fetch_product_list.php','true');
httpRequest.send("var=5");

but in the fetch_product_list.php, $_POST['var'] has nothing, How can I fix it?

You haven't included a content-type for the request body.

httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

Add line: httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); and hence the code looks like:

var httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = action;
httpRequest.open('POST','/fetch_product_list.php','true');
httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
httpRequest.send("var=5");

and in php use: $_POST['var'].