sdifjow

				var method = "post";
				var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
				xhr.onreadystatechange = function(){
					if(xhr.readyState === 4 && xhr.status === 200){
						alert(xhr.responseText);
					}
				};
				if(method === "post"){
					xhr.open("post","t.php");
					xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
					xhr.send("name=john");
				}else{
					xhr.open("get","t.php");
					xhr.send();
				}

  

posted @ 2014-03-24 03:05  secern  阅读(130)  评论(0)    收藏  举报