get id : ".$_GET[id].""; echo "get passwd : ".$_GET[passwd]."
"; echo "post id : ".$_POST[id]."
"; echo "post passwd : ".$_POST[passwd]."
"; ?>
'Language > Ajax' 카테고리의 다른 글
Ajax 간단한 예제소스 (0) | 2010.05.23 |
---|
get id : ".$_GET[id].""; echo "get passwd : ".$_GET[passwd]."
"; echo "post id : ".$_POST[id]."
"; echo "post passwd : ".$_POST[passwd]."
"; ?>
Ajax 간단한 예제소스 (0) | 2010.05.23 |
---|
var request = null; function createRequest() { try { request = new XMLHttpRequest(); } catch (trymicrosoft) { try { request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { request = null; } } } if (request == null) { alert("너가 사용하는 브라우저는 도대체 뭐냐..??"); } } function getBoardsSold() { createRequest() var content = document.getElementById("content"); var contentStr = getText(content); var url = "test.php?ContentStr=" + contentStr; request.open("GET", url, true); request.onreadystatechange = updatePage; request.send(null); } function updatePage() { if (request.readyState == 4) { if(request.status == 200) { var newContent = request.responseText; var contenttStr = document.getElementById("Content"); replaceText(contentStr, newContent); } else { alert("서버에러!!"); } } } function replaceText(el, text) { if (el != null) { clearText(el); var newNode = document.createTextNode(text); el.appendChild(newNode); } } function clearText(el) { if (el != null) { if (el.childNodes) { for (var i = 0; i < el.childNodes.length; i++) { var childNode = el.childNodes[i]; el.removeChild(childNode); } } } } function getText(el) { var text = ""; if (el != null) { if (el.childNodes) { for (var i = 0; i < el.childNodes.length; i++) { var childNode = el.childNodes[i]; if (childNode.nodeValue != null) { text = text + childNode.nodeValue; } } } } return text; }
GET방식 POST방식 (0) | 2010.05.23 |
---|