這是我的表單。這是一個條紋形式:jQuery AJAX POST未觸發
<form id = "the_form" method = "post">
<input type = "hidden" name = "plan" value = "silver"/>
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="<?php echo $stripe['publishable_key']; ?>"
data-description=""
data-amount="19900"
data-locale="auto"></script>
<input type = "hidden" name = "email" value = "<?php echo $_SESSION['b_email']; ?>"/>
<input type = "hidden" name = "id" value = "<?php echo $_SESSION['brand_id']; ?>"/>
</form>
我要發佈此表的數據文件名爲handle_stripe_push.php。這裏是我的jQuery AJAX POST調用:
$(document).ready(function(e) {
$("#the_form").submit(function(evnt){
console.log("Form submit event fired")
$.post('handle_stripe_push.php', $(this).serialize(), function(data){
alert(data);
}).fail(function(err, status){
console.log(err + " " + status)
})
evnt.preventDefault()
});
});
問題。當我點擊我的表單提交時,此功能甚至不會觸發。我知道這是因爲「表單提交事件被解僱」是而不是被輸出到我的控制檯。
我在Google Chrome上。我做了一個檢查元素,檢查了控制檯 - 有沒有錯誤顯示。
這是推動我有點瘋狂,我會感激你的幫助
你有一個jQuery的CDN? – momouu
不,我正在使用jquery我在本地安裝 – user5792950
顯示任何錯誤? – momouu