xhr.responseText 不能直接 alert ,得在 xhr 对象的回调函数里才能获取到
xhr.onreadystatechange = function(){ //Ajax状态码等于4:接收数据完成(服务器端处理完所有数据并返回数据) if(xhr.readyState==4){ alert(xhr.responseText); }}