ajax post/get 방식

Language/JAVA 2010. 10. 19. 12:09
//post
 name = encodeURIComponent(document.getElementById("myName").value);
 xmlHttp.open("POST", "quickstart.php", true);

xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charaset=UTF-8");
data = "name="+name;
xmlHttp.onreadystatechange = handleServerResponse;
xmlHttp.send(data);

//get
name = encodeURIComponent(document.getElementById("myName").value);
xmlHttp.open("POST", "quickstart.php?name="+name, true);

xmlHttp.onreadystatechange = handleServerResponse;
xmlHttp.send(null);
 
: