1
我想讓我的表單在ajax運行之前驗證,但似乎無法獲得編碼的權利,因爲這會發生。Ajax提交Spry驗證
如果我它們分開,我可以張貼使用Ajax和不驗證或驗證,但其職位的默認方式
這裏是我當前的代碼我試圖
$(document).ready(function(){
// ajax code start
$('#form').on('submit', function (e){
e.preventDefault();
if (spry.widget.form.validate('#form') == true)
{
$.ajax({
type: "POST",
url: "localProxy.php",
data: $('#form').serialize(),
success: function (response) {
document.location = '/thank-you';
// do something!
},
error: function() {
alert('There was a problem!'); // handle error
}
});
};
});
});
感謝這有助於。 – tlaverdure