How do I go about calling a method on an ASP.NET Web Form page using the getJSON method on jQuery?
The goal is this:
I tweaked your code a bit. I added the server side output of the ClientID to the updateRegions method to pass it in. And I changed your getJSON method to pass in the url with a query string parameter (instead of separate data) and the call back function.
jQuery(document).ready(function() {
jQuery("#<%= AreaListBox.ClientID %>").click(function() {
updateRegions(<%= AreaListBox.ClientID %>);
});
});
function updateRegions(areaId) {
jQuery("h2").html("AreaId:" + areaId);
jQuery.getJSON("/Locations.aspx/GetRegions?" + areaId,
function (data, textStatus) {
debugger;
});
}
Let me know if that works!