Pages

Subscribe:

Ads 468x60px

Wednesday, April 11, 2012

how to access web method or server side data at client side in asp.net using c#

In this web programming tutorial we will learn that how we can access server side data using Json ajax call at client side using asp.net or php. see the below code and just copy and past in your .aspx or .php file.
function BindPaymentRecord(txnId) { var request = "{'TXN_ID':'" + txnId + "'}"; $.ajax({ type: "POST", url: "Invoice.aspx/BindPaymentDetail", data: request, contentType: "application/json; charset=utf-8", dataType: "json", success: SuccessPaymentRecord }); } function BindChargesRecord(txnId) { var request = "{'TXN_ID':'" + txnId + "'}"; $.ajax({ type: "POST", url: "Invoice.aspx/BindChargesDetail", data: request, contentType: "application/json; charset=utf-8", dataType: "json", success: ChargesSuccessData }); } function SuccessPaymentRecord(data) { document.getElementById('<%=A_Paid.ClientID %>').innerHTML = data.d[0]; document.getElementById('<%=C_ref.ClientID %>').innerHTML = data.d[1]; document.getElementById('<%=C_Bal.ClientID %>').innerHTML = data.d[2]; document.getElementById('<%=Error.ClientID %>').innerHTML = data.d[3]; document.getElementById('<%=P_Method.ClientID %>').innerHTML = data.d[4]; document.getElementById('<%=P_date.ClientID %>').innerHTML = data.d[5]; }

1 comment:

Website Design Melbourne said...

Really appreciate this wonderful post that you have provided for us.

Post a Comment