我在我的網站提交註冊表單後關閉我的fancybox。 我使用CMS Pro系統....在ajax成功確認表格後關閉fancybox
有了這個,我展示的fancybox形式包括:
submitHandler: function(form) {
var str = $("#subscriber_application").serialize();
$.ajax({
type: "POST",
url: "ajax/user.php",
data: str,
success: function (msg){
$("div#subscriber_response").html(msg);
$("#subscriber_application").hide();
}
});
}
我的HTML:
<div id="divForm" style="display:none;min-height: 400px;">
<div class="fr" style="min-height: 400px;">
<div>
<div style="position:relative">
<div id="msgholder"></div>
</div>
<form action="" method="post" id="admin_form" name="admin_form">
<input name="email" type="text" size="45" maxlength="40" class="home_input" placeholder="Email Address" />
<input name="token" type="text" size="45" maxlength="40" class="home_input" placeholder="Token" />
<input name="submit" value=" " type="submit" class="account_activate"/>
</form>
<?php echo $core->doForm("accActivate","ajax/user.php");?>
</div>
<div style="width:800px;"></div>
<h1>Subscribe For Free Application</h1>
<hr />
<p> </p>
<div class="registracia">
<div id="subscriber_response" class="msgErrors"></div>
<div id="post_your_requirement_success" ></div>
<form action="" method="post" id="subscriber_application" name="subscriber_application" style="width:270px;">
<p>
<input data-progression="" type="text" data-helper="Username should be at least 3 characters long" name="username" value="" class="home_input" placeholder="User name" name="username" />
</p>
<p>
<input data-progression="" type="text" data-helper="Add your E-mail" name="email" class="home_input" placeholder="Email address" value="<?php if(isset($_SESSION['subscriber_application']['email_address'])):echo $_SESSION['subscriber_application']['email_address'];endif; ?>" />
</p>
<p>
<input data-progression="" type="text" data-helper="Your Restaurant Name" name="hotel_name" class="home_input" placeholder="Restaurant name" />
</p>
<p>
<input data-progression="" type="password" data-helper="Add Password - min 4 characters" name="password" class="home_input" placeholder="Password" />
</p>
<p>
<!--- <input tabindex="13" type="checkbox" id="flat-checkbox-1" />I agree, I've read <a href="#">terms of use</a> -->
</p>
<input name="submit" type="submit" id="submit" value=" " class="sign_in" />
<input name="doapplication" type="hidden" value="1" />
</form>
</div>
<div style="social">
<h2>Sign in with social network!</h2>
<ul>
<li style="list-style:none"><img src="../demo/theme/master/images/g+.jpg" /></li>
<li style="list-style:none"><img src="../demo/theme/master/images/faceb.jpg" /></li>
</ul>
</div>
我的按鈕:
<a href="#divForm" id="btnForm">
<button type="button" class="way-start" style="border-radius: 5px;height: 60px;width: 180px;background-color: green;border: 1px solid green;font-size: 26px;font-weight: 300;font-family: Helvetica Neue, Helvetica, Sans Serif;">Get the app!</button>
</a>
我會感激每一個意見! 謝謝!
你可以顯示'#btnForm'的HTML?我認爲你並不需要在'onStart'和'onClosed'中應用css樣式。另一方面,如果您在表單提交後關閉fancybox,除非設置延遲(setTimeout)或添加按鈕手動關閉fancybox,否則您將無法看到「謝謝」消息:您想要做什麼? – JFK
Hello JFK感謝您的幫助....我編輯了代碼。首先,我想要延遲關閉......或者你有更好的想法嗎? – Makromat
我不應該調試你的代碼,但是如果你將一個'click'綁定到像'$(「#submitemail」)這樣的元素,點擊()',至少應該有一個id =「submitemail」元素,我沒有看到你的代碼(我沒有看到任何'id =「btnForm」')。順便說一句,php代碼在你的問題的背景下是不相關的。請僅發佈呈現的html。 – JFK