本應該是一個非常簡單的事情要做就是使其本身非常艱難。簡單的方法來切換模式不工作從JavaScript。下面是代碼:模式切換方法不通過javascript
<div class="modal1 mfp-hide" id="modal-signup">
<div class="block divcenter" style="background-color: #FFF; max-width: 400px;">
<div style="padding: 50px;">
<h3 class="font-body">Signup for an account</h3>
<div class="help-block with-errors has-errors" id ="signupError"></div>
<form action="#" id="signup_modal" method="post" class="nobottommargin">
<div class="form-process"></div>
<div class="col_full">
<label class="font-body capitalize" for="signup-form-modal-name">Name:</label>
<input type="text" id="signup_form_modal_name" name="signup-form-modal-name" value="" class="form-control" required />
</div>
<div class="col_full">
<label class="font-body capitalize" for="signup-form-modal-username">Email:</label>
<input type="text" id="signup_form_modal_username" name="signup-form-modal-username" value="" class="form-control" required />
</div>
<div class="col_full">
<label class="font-body capitalize" for="signup-form-modal-password">Password:</label>
<input type="password" id="signup_form_modal_password" name="signup-form-modal-password" value="" class="form-control" required />
</div>
<div class="col_full">
<label class="font-body capitalize" for="signup-form-modal-password">Repeat Password:</label>
<input type="password" id="signup_form_modal_repassword" name="signup-form-modal-repassword" value="" class="form-control" required />
</div>
<div class="col_full">
<label class="font-body capitalize" for="signup-form-modal-mobile">Mobile:</label>
<input type="text" id="signup_form_modal_mobile" name="signup-form-modal-mobile" value="" class="form-control" required />
</div>
<div class="col_full nobottommargin">
<button class="button button-rounded nomargin" id="signup_form_modal_submit" name="signup-form-modal-submit" value="signup">Signup</button>
</div>
</form>
<div class="line line-sm"></div>
<a href="#" class="button button-rounded btn-block t400 center capitalize si-facebook si-colored noleftmargin norightmargin">Signup with Facebook</a>
<a href="#" class="button button-rounded btn-block t400 center capitalize si-gplus si-colored nomargin">Signup with Google</a>
</div>
</div>
$("#signup_form_modal_submit").click(function(e){
$.post("<?php echo BASE_URL.'/login/register';?>", $('#signup_modal').serialize(),function(data){
if(data['a']==1){
$("#modal-signup").modal('toggle');
//$("#modal-signup").modal('hide');
//$("[data-dismiss=modal]").trigger({ type: "click" });
}
}
});
有任何JS沒有問題作爲一切工作正常。即使點擊這個模式的關閉按鈕關閉這個罰款,似乎只有js的問題。
我想關閉此模式並打開另一個模式。任何人都可以幫忙嗎?
檢查你有什麼迴應得到,去'的console.log(數據)'IF語句之前,或在瀏覽器中檢查,網絡選項卡檢查。 – skobaljic
這是我從ajax響應發送的內容。這是一個數組。 –
是響應json? –