Similar Question:
Executing non-static method in aspx.cs from client side using javascript (aspx)
The code snippet below is currently functioning correctly
function getFooObj() {
$.ajax({
type: "POST",
url: "Dummy.aspx/GetFooObj",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
alert('good');
}
});
}
[WebMethod]
public static FooObj GetFooObj ()
{
// some code that returns FooObj
}
My query pertains to making my WebMethod NOT static and how I can then access it from JavaScript?
[WebMethod]
public FooObj GetFooObj ()
{
// some code that returns FooObj
}