<form action="index.php?page=checkin" method="post" name="regForm">
<div id="First_1">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<table cellpadding="0" cellspacing="5">
<tr>
<td style="padding: 5px;">
Fullständiga namn:
</td>
<td>
<input name="full_name" type="text" id="full_name" class="required">
</td>
</tr>
<tr>
<td style="padding: 5px;">
Email:
</td>
<td>
<input name="usr_email" type="text" id="usr_email3" class="required">
</td>
</tr>
<tr>
<td style="padding: 5px;">
Sex:
</td>
<td>
<select name="sex">
<option value="male">
Kille
</option>
<option value="female">
Tjej
</option>
</select>
</td>
</tr>
<td>
<input type="submit" id="continue" value="Fortsätt">
</td>
</table>
</td>
</tr>
</table>
</div>
<div id="Next_2" style="display: none">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<table cellpadding="0" cellspacing="5">
<tr>
<td style="padding: 5px;">
Lösenord:
</td>
<td>
<input name="pwd" type="password" class="required password" id="pwd">
</td>
<td>
En gång till..
</td>
<td>
<input name="pwd2" id="pwd2" class="required password" type="password">
</td>
<td>
<input name="doRegister" type="submit" id="doRegister" value="Register">
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</form>
<script type="text/javascript">
$(function() {
$("#continue").click(function() {
$.ajax({
type: "POST",
url: "dbc.php",
data: {
check: 'First',
full_name: $('#full_name').val(),
usr_email: $('#usr_email3').val()
},
success: function(msg) {
if (msg == '1') {
$("#First_1").hide();
$("#Next_2").toggle();
} else {
alert(msg);
}
}
});
return false;
});
});
</script>
그 형식입니다. 3 개의 양식 요소를 채우고 계속 단추를 누른 다음 ajax 호출을 보내 필드를 확인합니다. everythings OK (ajax 호출에서 output = 1 인 경우), Next_2가 토글되며 여기서 암호를 두 번 입력합니다. 그 후 당신은 "action = index.php? page = checkin"을 수행해야하는 최종 단추 Register를 누른다. 그러나 레지스터를 누를 때 그냥 공백이 생기고 나 자신이 또 다른 Ajax 호출을 보내는 것을 볼 수있다. 버튼은 id = "continue"이지만 id = "doRegister"를 갖지 않기 때문에 이해할 수 없습니다.양식 2 버튼 + 자바 스크립트 문제