Well after searching again on internet I found the answer or my own question.
That we can call only static method through jQuery.ajax() and the method must be enabled with [System.Web.Services.WebMethod]
Now the solution is
Html code
<input type="button" onclick="callServer()" value="Test Button" />
<asp:label id="lblTest" runat="server" xmlns:asp="#unknown">
</asp:label>
Server side Code
[System.Web.Services.WebMethod]
public static string myMethod()
{
return DateTime.Now.ToString();
}
And,finally, jQuery
function callServer() {
$.ajax(
{
type:"POST",
url: "jQuery.aspx/myMethod",
data: "{}",
contenType:"application/json",
dataType :"json",
success: function(data){
$("#lblTest").text(data.d);
},
fail:onFail
});
}
function onFail() {
alert("Failed!!");