저는 모든 클라이언트 측 js 및 html로 작업하고 있습니다. 다음과 같은 상황이 있습니다 ... 일부 입력 및 제출 단추가 들어있는 html 양식 (index.html)이 있습니다. 그 외에도 양식에는 다른 HTML 양식을 포함하는 다른 페이지 (other.html)를 참조하는 iframe 태그가 들어 있습니다. 것은 other.html이라는이 다른 페이지에 있습니다. 일부 정보를 저장하는 양식 태그 안에 텍스트 입력 (name = "info")이 있습니다.자바 스크립트 및 iframe 문제
이제는이 정보의 입력 값을 index.html 형식으로 제출하고 싶습니다.
예 index.html을 :
<html>
<body>
<form method="post" action="aphpfile.php">
<input type="text" name="a"/>
<input type="text" name="b"/>
<input type="text" name="c"/>
<iframe id="other1" width="408" height="200" frameborder="0"
scrolling="no" marginheight="0"
marginwidth="0" src="other.html"></iframe>
<input type="submit" value="submit"/>
</form>
</body>
</html>
예 other.html :
이<html>
<script type="text/javascript">
function setInfo() {
document.getElementById("info").value = "this is the info";
}
</script>
<body>
<form>
<input type="text" id="info" name="info"/>
</form>
<input type="button" onclick="setInfo();" value="setInfo"/>
</body>
</html>
그래서 aphpfile.php에서 나는이 작업을 수행 할 수 :
$a = $_POST['a'];
$b = $_POST['b'];
$c = $_POST['c'];
$info = $_POST['info'];
echo $a . "," . $b . "," . $c . "," . $info;
을 주셔서 감사합니다 당신의 도움.
당신이 제출 양식에 숨겨진 입력으로 변수를 추가 희망 아약스 호출을 통해. ajax 호출의 성공 함수에 변수를 현재 양식에 추가하십시오. –
안녕하세요, 답변 해 주셔서 감사합니다. 예를 들어주세요. 나는 js 아약스와이 모든 것들을 배우는 중이다. 고맙습니다! – Alejandro
나는 당신이 말하는 것을 가지고있다. 그러나 나는이 아약스 코드를 어떻게 쓰는지 모른다. 다시 thx – Alejandro