Access Code Behind variable in .aspx page in jquery
How to access the .aspx.cs variable on .aspx page using jquery..
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Priyaranjan K SRank #45 · 32.5K reputationPosted Oct 9, 2015, 4:34 AM EDT
Mukesh KumarRank #119 · 18.2K reputationPosted Oct 9, 2015, 4:22 AM EDT
$(document).ready(function () { $("#MainContent_ddlCountry").change(function () { $("#tblCustomers tbody tr").remove(); $.ajax({ type: "POST", url: "Default.aspx/GetCustomers", data: '{country: "' + $(this).val() + '" }', contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { response($.map(data.d, function (item) { var rows = "" + "" + item.CustomerID + "" + "" + item.CompanyName + "" + "" + item.ContactName + "" + "" + item.ContactTitle + "" + "" + item.City + "" + "" + item.Phone + "" +""; $('#tblCustomers tbody').append(rows); })) }, failure: function (response) { var r = jQuery.parseJSON(response.responseText); alert("Message: " + r.Message); alert("StackTrace: " + r.StackTrace); alert("ExceptionType: " + r.ExceptionType); } }); }); });magesh manavalanRank #6,279 · 271 reputationPosted Oct 9, 2015, 4:26 AM EDT
Sanjay SabariyaRank #2,262 · 623 reputationPosted Oct 9, 2015, 4:54 AM EDT
Krishna Rajput SinghRank #605 · 4K reputationPosted Oct 9, 2015, 7:08 AM EDT
Abhishek KumarRank #1,734 · 872 reputationPosted Oct 9, 2015, 10:25 AM EDT