我正在处理 Authorize.net 表单提交。
$api_login_id = $bookingSettingObj->getAuthorizeAPI(); // works
$transaction_key = $bookingSettingObj->getAuthorizeTXN(); // works
$amount = /* What should i put here so i can echo the final price that is calculated by Javascript Function : addToAuthorizeForm(); ????? */
价格计算由 javascript 函数 addToAuthorizeForm 完成。请让我知道我应该添加什么代码,以便 javascript 函数“addToAuthorizeForm”可以成功回显..
更新 :
我已经在使用 Ajax。这是我正在使用的 javascript 函数。我只需要知道我放了什么代码来执行这个javascript函数并回显最终价格..
function addToAuthorizeForm() {
$wbc('#slots_purchased').html('');
var new_html = '';
var i = 1;
$wbc('#booking_slots').find('input').each(function() {
if($wbc(this).attr('checked')) {
var slot_id = $wbc(this).val();
//ajax request to get data
$wbc.ajax({
url: '<?php echo plugins_url('my_plugin/public');?>/ajax/getSlotInfo.php?slot_id='+$wbc(this).val(),
success: function(data) {
arrData=data.split("$");
if(arrData[1]>0) {
q = 1;
if($wbc('#seats_'+slot_id).val()!=undefined) {
q = $wbc('#seats_'+slot_id).val();
}
new_html += '<input type="hidden" name="item_name_'+i+'" value="'+arrData[0]+'" /><input type="hidden" name="amount_'+i+'" value="'+arrData[1]+'" /><input type="hidden" name="quantity_'+i+'" value="'+q+'" />';
$wbc('#slots_purchased').html(new_html);
i++;
}
}
});
}
});
}