get
function addURLParam(url,name,value){
url += (url.indexOf(?) == -1 ? "?" : "&");
url +=encodeURIComponent(name) +"="+encodeURIComponent(value)
return url
}
xhr.open("get",url,false);
post
xhr.open("post","postexample.php",true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
var form = document.getElementById("user-info");
xhr.send(serialize(form));