有人可以说这段代码是对还是错?
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;
}
这是我的单选按钮,当我点击任何一个按钮时,它会具有单独的值,它将添加之前的值
的javascript
Javascript功能
Function getPaymentVal()
{
Var checkboxVal = ‘’;
checkboxVal = $("input[@name=’rmr’]:checked").val();
$.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>”);
}
});
}
答案 0 :(得分:0)
看看这段代码,我认为这是可能的,因为"
和'
字符从另一个不同的字符编码源粘贴得很差。您应该再次键入它以查看错误是否发生。
答案 1 :(得分:0)
看起来您从其他来源复制粘贴此代码并且引号混乱。请改用
$.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>");
}
});