【发布时间】:2010-12-30 18:16:29
【问题描述】:
您好,我正在开发我的项目。如何调用onclick按钮的ajax函数。
If(isset($_POST) && ($_POST[‘GET_PAYMENT’] == ‘1’))
{
$totalAmount = $_POST[‘GET_PAYMENT’]; //Total amount
$checkbox_id = $_POST[‘VALUE’]; // The radio button value
/* Here get the amount values (3,5.5 or 10) from
Database based on the $checkbox_id and store it in
$amount variable*/
$total_amount = $amount + $totalAmount;
Echo $total_amount;
}
$.ajax({
type: "POST",
url: "ajax.php",
data: "GET_PAYMENT=1&VALUE=”+ checkboxVal,
success: function(total_amount)
{
//Assigning the final value to the hidden value here
$(‘#totalamount’).val(total_amount);
//Here changing the display of total amount
$(‘#repair_total_amount’).html(“Total <span class="repair-finalamount-txt">£ ”+ total_amount+”</span>”);
}
});
}
我对此感到困惑:data: "GET_PAYMENT=1&VALUE=”+ checkboxVal,我必须执行哪个操作。这是因为当我单击该单选按钮时,它将与 addcart 一起添加。
任何一个都可以
【问题讨论】:
-
这看起来很眼熟。是你吗? :) stackoverflow.com/questions/4537799/radio-button-value-for-add
-
@Spiny Norman,不......当然只是宇宙巧合......