0
我有一個PayPal按鈕,它將表單提交給表單的action=""
屬性中指定的url。我希望這個按鈕可以在提交表單的同時(或大致相同)觸發ajax調用。貝寶按鈕提交表單並同時觸發Ajax調用?
所以形式如下:
<?php echo('
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="payWithPayPalForm">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="amount" value="'.$price.'">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest" >
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" id="payWithPayPalButton" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/pl_PL/i/scr/pixel.gif" width="1" height="1">
</form>
');
?>
而且AJAX請求如下:
$.ajax({
type: "POST",
url: "classes/acceptOfferFunction.php",
data: {
hash: getURLParameter('hash'),
hash2: getURLParameter('hash2')
},
success: function (result) {
}
});