嗨,我使用过贝宝(Paypal)的自适应支付功能,当我单击“付款”按钮时,它会打开迷你浏览器,但我希望仅在选中收音机后才能打开它。
<script type="text/javascript" charset="utf-8">
var returnFromPayPal = function() {
document.getElementById('loading').style.display = 'block';
document.getElementById('fade').style.display = 'block';
$.ajax({
type: "POST",
url: "<?php echo base_url().'room_booking/success_handler' ;?>",
data: {
'roomdata': roomData,
'userdata': userData
},
success: function(response) {
document.getElementById('loading').style.display = 'none';
document.getElementById('fade').style.display = 'none';
if (response == 'cancelled') {
$("#paymentError").html('<span class="disablebtnInfo" id="msg" style="display:block;margin-left: 40%;"><span class="error_sign">Oops !</span> <span id="errmsg">Your payment was interrupted, please make sure your payment</span></span></strong>');
} else {
$("#step3").removeClass("progtrckr-todo").addClass("progtrckr-done");
$("#step4").removeClass("progtrckr-todo").addClass("progtrckr-done");
$("#replaceMe").html(response);
}
}
});
// Here you would need to pass on the payKey to your server side handle to call the PaymentDetails API to make sure Payment has been successful or not
// based on the payment status- redirect to your success or cancel/failed urls
};
var dgFlowMini = new PAYPAL.apps.DGFlowMini({
trigger: 'submitBtn',
expType: 'mini',
callbackFunction: 'returnFromPayPal'
});
</script>
怎么做
假设单选按钮是页面上的一段HTML,例如,并且您正在使用jquery,然后将$ .ajax()调用放入单选按钮的测试中,例如:
if ($('#dopaypal').val()) {
$.ajax(...)
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句