我使用contact_me.js和contact_me.php引導contact_form來提交我的聯繫表單。我遇到的問題是我有一個頁面的網站,進一步的頁面是一個貝寶按鈕。當我點擊貝寶按鈕時,它正在提交聯繫表單。從另一個按鈕提交bootstrap contact_me
我試圖做一個對PayPal按鈕「返回false」停止這一點,然後有PayPal按鈕點擊該提交貝寶形式
我的繼承人貝寶形式的jQuery函數
<form action="https://www.paypal.com/cgi-bin/webscr" name='paypalForm' method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="G8FJ3NGXWAE6G">
<input type="hidden" name="on0" value="Reservations">Reservations:<br />
<select name="os0">
<option value="One Bike">One Bike €300.00</option>
<option value="Two Bikes">Two Bikes €600.00</option>
<option value="Three Bikes">Three Bikes €900.00</option>
</select>
<input type="hidden" name="currency_code" value="EUR"><br />
<input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110429-1/en_US/GB/i/btn/btn_buynowCC_LG.gif" border="0" name="button" onclick="return false;"id='paypalButton' alt="PayPal - The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110429-1/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
我的繼承人上點擊功能的jQuery(我把警報,以檢查它被稱爲)
$("#paypalButton").click(function() {
alert('here');
$("#paypalForm").submit();
});
這裏是被稱爲contact_me.js的開放,如果我不哈VE一對PayPal按鈕
$("input,textarea").jqBootstrapValidation({
preventSubmit: true,
submitError: function($form, event, errors) {
// something to have when submit produces an error ?
// Not decided if I need it yet
},
submitSuccess: function($form, event) {
event.preventDefault(); // prevent default submit behaviour
// get values from FORM
var name = $("input#name").val();
var phone = $("input#phone").val();
var email = $("input#email").val();
var message = $("textarea#message").val();
var firstName = name; // For Success/Failure Message
// Check for white space in name for Success/Fail message
if (firstName.indexOf(' ') >= 0) {
firstName = name.split(' ').slice(0, -1).join(' ');
}......... etc
我怎樣才能得到PayPal按鈕無需提交聯繫表單「返回false」?
我是否必須更改contact_me.js(以及如何)或者可以從$('#paypalButton')。click()?