Call Server Side Function From JavaScript In ASP.NET(C#)

In aspx page i am write Page Method for call server side function and also set EnablePageMethods="True" in ScriptManager.
 
Default.aspx 
  1. <html xmlns="http://www.w3.org/1999/xhtml">  
  2. <head runat="server">  
  3. <title></title>  
  4. <script type="text/javascript" language="javascript">  
  5.    function Displaymsg() {  
  6.       var name = document.getElementById('<%= txtName.ClientID %>').value;  
  7.             PageMethods.GetWelcomemsg(name, OnSuccess, onerror);  
  8.       }  
  9.    function OnSuccess(result) {  
  10.       if (result) {  
  11.          alert(result);  
  12.          return false;  
  13.       }  
  14.    }  
  15.    function onerror(error) {  
  16.          alert(error);  
  17.    }  
  18. </script>  
  19. </head>  
  20. <body>  
  21. <form id="form1" runat="server">  
  22.    <div>  
  23.       <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True">  
  24.       </asp:ScriptManager>  
  25.       Enter Your Name:  
  26.       <asp:TextBox ID="txtName" runat="server"></asp:TextBox>  
  27.       <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClientClick="return Displaymsg();" />  
  28.    </div>  
  29. </form>  
  30. </body>  
  31. </html>  
Default.aspx.cs 
  1. using System.Web.Services;  
  2. [WebMethod]  
  3. public static string GetWelcomemsg(string name)  
  4. {  
  5. return "Welcome " + name;  
  6. }