看来我在使用 jQuery ajax 表单时遇到了问题,尽管表单字段似乎是空的,但它一直发送相同的值。因此我假设 jQuery 是“缓存”或不覆盖我定义的变量。
function payment(projectID, billID)
{
$.ajax
({
url: 'modules/projects/projectFinancial.php?action=paymentDetails&projectID=' + projectID + '&billID=' + billID + '&rand=' + Math.random(),
dataType: 'html',
async: false,
success: function(msg)
{
$("#paymentDetails").html(msg);
}
});
$("#payment").dialog(
{
width: 500,
height: 300,
modal: true,
buttons:
{
Save: function()
{
var paymentAmount = $("#PaymentAmount").val();
var paymentMethod = $("#PaymentMethod").val();
var paymentRemarks = $("#PaymentRemarks").val();
if ($('#PaymentDone').is(':checked'))
{
var paymentDone = 1;
}
else
{
var paymentDone = 0;
}
$.ajax
({
url: 'modules/projects/projectFinancial.php?action=payment&projectID=' + projectID + '&billID=' + billID + '&paymentAmount=' + paymentAmount + '&paymentMethod=' + paymentMethod + '&paymentRemarks=' + paymentRemarks + '&paymentDone=' + paymentDone + '&rand=' + Math.random(),
dataType: 'html',
async: false,
success: function(msg)
{
if (msg != "error")
{
showFinancial(msg, '{/literal}{$marginCalculated}{literal}');
}
}
});
$(this).dialog("close");
}
}
});
}