我的表单存在这个问题,一旦提交,如果您没有填写任何字段,您将收到一条错误消息。我希望用户在看到错误消息后可以选择取回表单并可以选择重新填写。我觉得我可以解释清楚,自己检查:www.insead4sq.com
<form method="post" action="default.asp?Process=add" id="SIGNUPFORM"><a href="#" name="signup"></a>
<fieldset>
<p>
<label>Name</label>
<input type="text" name="FIRSTNAME" id="FIRSTNAME" size="55" value="" />
</p>
<p>
<label>Surname</label>
<input type="text" name="LASTNAME" id="LASTNAME" size="55" value="" />
</p>
<p>
<label>Email Address</label>
<input type="text" name="EMAILADDRESS" id="EMAILADDRESS" size="55" value="" />
</p>
<p>
<label>Password</label>
<input type="password" name="PASSWORD" id="PASSWORD" size="55" value="" />
</p>
<p>
<label>Hometown</label>
<input type="text" name="CITY" id="CITY" size="55" value="" />
</p>
<p>
<input type="button" name="signup" value="Sign Up" class="submit" />
</p>
</fieldset>
</form>
<script type="text/javascript">
$(document).ready(function() {
$("[name='signup']").click(function() {
$.ajax({
type: "POST",
data: $("#SIGNUPFORM").serialize(),
url: "default.asp?Process=add",
success: function(output) {
$('#SIGNUPFORM').html(output)
},
error: function(output) {
$('#SIGNUPFORM').html(output);
}
});
});
$(function update() {
$.ajax({
type: "GET",
url: 'default.cs.asp?Process=TotalMembers',
timeout: 2000,
success: function(data) {
$(".totalmembers").html(data);
window.setTimeout(update, 5000);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$(".totalmembers").html('.');
window.setTimeout(update, 60000);
}
});
});
});
</script>