Please take a look at the question I asked not so long ago: jQuery-UI Dialog Please look at the question I marked as the correct one.
The problem I have now is that I don't know exactly in the aspx page how to access the data from the ajax call. Can I call the Save method on my page(c#) directly? How do I send the parameters to be saved? My ajax call looks like this now:
function AjaxSavePayment()
{
$.ajax({
type: "POST",
url: "Payments.aspx",
data: "doFunction=True",
success: function () {alert("C开发者_C百科# Function was executed!");}
});
}
Thanks.
I used PageMethods instead.
function AjaxSavePayment()
{
var rdCash = document.getElementById("<%= rdCash.ClientID %>").checked;
var rdCCard = document.getElementById("<%= rdCCard.ClientID %>").checked;
var rdCheck = document.getElementById("<%= rdCheck.ClientID %>").checked;
var txtAmountCash = document.getElementById("<%= txtAmountCash.ClientID %>").value;
var txtCCardNumber = document.getElementById("<%= txtCCardNumber.ClientID %>").value;
var txtCCardExpMonth = document.getElementById("<%= txtCCardExpMonth.ClientID %>").value;
var txtCCardExpYear = document.getElementById("<%= txtCCardExpYear.ClientID %>").value;
var txtAmountCCard = document.getElementById("<%= txtAmountCCard.ClientID %>").value;
var txtCheckNumber = document.getElementById("<%= txtCheckNumber.ClientID %>").value;
var txtCheckDate = document.getElementById("<%= txtCheckDate.ClientID %>").value;
var txtAmountCheck = document.getElementById("<%= txtAmountCheck.ClientID %>").value;
var drpCCardCompany = document.getElementById("<%= drpCCardCompany.ClientID %>").value;
var MemberID = GetQueryVariable("MemberID");
var ShulID = '<%=Session["ShulID"]%>';
var PayTwardsPledgeID = "";
PayTwardsPledgeID = GetQueryVariable("PayTwardsPledgeID");
var PaymentMethod = "";
if (rdCash)
{
PaymentMethod = "Cash";
}
if (rdCCard) {
PaymentMethod = "CCard";
}
if (rdCheck) {
PaymentMethod = "Check";
}
PageMethods.SavePaymentWeb(ShulID, MemberID, PaymentMethod, txtAmountCash, txtAmountCCard
, txtAmountCheck, txtCCardNumber, txtCCardExpMonth, txtCCardExpYear
, txtCheckNumber, txtCheckDate, drpCCardCompany, PayTwardsPledgeID, OnSuccess);
});
}
精彩评论