我從來沒有創建過聯繫表,並且在得到這個提交出於某種原因的問題。它證實罰款,但當我點擊提交,它什麼都不做。沒有錯誤。沒有。我一直在爲此工作12個多小時,對於我的生活我無法弄清楚什麼是錯的。這裏是包含AJAX代碼的jQuery代碼。阿賈克斯沒有提交聯繫表
$(document).ready(function() {
$("#form1").validationEngine({
ajaxSubmit: true,
ajaxSubmitFile: "ajaxSubmit.php",
ajaxSubmitMessage: "Thank you, We will contact you soon !",
inlineValidation: false,
success: function() {
callSuccessFunction()
},
failure: function() {}
})
});
這裏是html頁面
<form class="form" id="form1" method="post" action="ajaxSubmit.php">
<input class="validate[required,custom[onlyLetter],length[0,100]] text-input" type="text" name="name" id="name" placeholder="How may I address you?"><label for='name '>name</label><br />
<input class="validate[required,custom[email]] text-input" type="text" name="email" id="email" placeholder="I promise, I hate spam as much as you do."><label for='email '>email</label><br />
<input class="validate[required,length[0,100]] text-input" type="text" name="budget" id="budget" placeholder="$USD amount, please."><label for='budget '>budget</label><br />
<textarea name="message" class="validate[required,length[6,300]] text-input" id="comment" placeholder="What's on your mind?"></textarea><br />
<p class="submit"><input type="submit" value="Send"></p>
</form>
對代碼的形式而這是「ajaxSubmit.php代碼完全
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$budget = $_POST['budget'];
$body = $_POST['text'];
$receiver = "[email protected]";
if (!empty($name) & !empty($email) && !empty($body)) {
$body = "Name:{$name}\n\nBudget :{$budget}\n\nComments:{$body}";
$send = mail($email, 'Contact Form Submission', $body, "From: {$email}");
if ($send) {
echo 'true';
}
}
?>
我拉我的頭髮在這裏,因爲我真的想要這個特定的表單工作,並且我SOOOOOO關閉。我喜歡它在同一頁上驗證的方式,而不是在用戶試圖提交不正確填寫的表單後,我真的不想我的我因爲他們沒有輸入任何內容,或輸入了錯誤信息,因此輸入了整個電子郵件。
謝謝編輯Shinosha。不幸的是,這種形式仍然不起作用。任何想法爲什麼? – Naomi