フォームが正常に完了した後、ユーザーをサンキュー ページにリダイレクトする際に問題が発生しています。何が起こるかというと、フォームが送信された後、空白のページ ( https://cunet.sparkroom.com/Sparkroom/postLead ) に移動します...フォームの詳細を「フォーム アクション」の URL。
HTML コード:
<form action="https://cunet.sparkroom.com/Sparkroom/postLead/" method="post" name="theForm"
id="theForm" onSubmit="return MM_validateForm();" >
...
</form>
Ajax コード:
<script src="http://malsup.github.com/jquery.form.js"></script>
<script>
$('#theForm').ajaxForm(function() {
window.location.href = "I want the user to be redirected to this page";
});
</script>
JavaScript:
function MM_validateForm() {
if ( !jQuery('#theForm #FirstName').val() ) {
alert('Please input your first name.');
jQuery('#theForm #FirstName').focus();
return false;
}
if ( !jQuery('#theForm #LastName').val() ) {
alert('Please input your last name.');
jQuery('#theForm #LastName').focus();
return false;
}
if ( !jQuery('#theForm #daytimephone').val() ) {
alert('Please input your phone number.');
jQuery('#theForm #daytimephone').focus();
return false;
}
if ( !jQuery('#theForm #Email').val() ) {
alert('Please input your email.');
jQuery('#theForm #Email').focus();
return false;
}
if ( !jQuery('#theForm #BID').val() ) {
alert('Please select your preferred campus.');
jQuery('#theForm #BID').focus();
return false;
}
if ( !jQuery('#theForm #programs').val() ) {
alert('Please select your preferred program.');
jQuery('#theForm #programs').focus();
return false;
}
if ( !jQuery('#theForm #How_Heard').val() ) {
alert('Please select how you heard about us.');
jQuery('#theForm #How_Heard').focus();
return false;
}
return true;
}
// ]]></script>
私が間違っていることを誰かが知っていますか?データを URL に送信するためのフォームが必要であり、ユーザーを「ありがとう」ページにリダイレクトした後、現在はまったく発生していません。