A dummy page method :
[WebMethod()]public static string sayHello(){return "hello ";} Please note that page methods must be declared as static, meaning a page method is completely self-contained, and no page controls are accessible through the page method.
Calling a page method from jQuery:
<script type="text/javascript">$(document).ready(function() {$.ajax({type: "POST",url: "pagemethod.aspx/sayHello",contentType: "application/json; charset=utf-8",data: "{}",dataType: "json",success: AjaxSucceeded,error: AjaxFailed}); });function AjaxSucceeded(result) {alert(result.d);}function AjaxFailed(result) {alert(result.status + ' ' + result.statusText);} </script>