var xhr = new XMLHttpRequest(); function t1(){ xhr.open('post','a3.PHP'); xhr.setRequestHeader('content-type','application/x-www-form-urlencoded'); //post 必写 xhr.onreadystatechange = function (){ if(xhr.readyState == 4){ var obj = eval('(' + xhr.responseText + ')') //把字符串转成了JS对象~~ alert(obj.username) //直接读取对象属性~ } } xhr.send(null); //有没有数据都要send() } </script> </head> <body> <input type="button" value="接收json格式" onclick="t1();" />