0
텍스트 필드와 함께 다른 페이지로 보내려는 지정된 ID 번호가 포함 된 텍스트 양식이 있습니다. 그게 가능할까요?AJAX를 통해 텍스트 양식에서 다른 페이지로 다른 값 전달
<form name="cForm" id="cForm">
Comment: <input type="textBox" name="cText" id="cText" />
<input type="button" name="submitCreate" id="submitCreate" value="Create" onclick="showCreate('.$row['ID'].')" /><br>
</form>
<script>
function showCreate(str) {
if (str=="") {
document.getElementById("showCreate").innerHTML="";
return;
}
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById("showCreate").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("Post","showCreate.php?q="+str,true);
xmlhttp.send();
}
</script>
내가 바로하지만이 시도 이해하도록
$comment = $_REQUEST["q"];
$ID = $_REQUEST["p"];
안녕하세요 @volkinc 나는'Uncaught ReferenceError : s가이'' "="+ s + "& p ="+ $ ("# cText")에 대해 정의되어 있지 않습니다. 내부에? – user2691544
죄송합니다. 그것은 오타입니다. s = str. 당신이 함수에 넘겨주는 전쟁 – volkinc
이것은 정확하게 필요한 것입니다. 감사합니다 @ volkinc – user2691544