I attempted to invoke a C# method using jQuery but it failed. The reason is because the method cannot be found. However the method exist in the class. Did I miss something?

Your help is kindly appreciated.

Thank You

Try using Page Methods or web services.

With Page Methods, you will not need to use jQuery.

http://www.singingeels.com/Articles/Using_Page_Methods_in_ASPNET_AJAX.aspx

Remember that your method needs to be static.

You mean I should replace the code below:

public string returnJson(){
        tojson = Json.ToJSON(people);
        return tojson;
    }

To:

public static string returnJson(){
        tojson = Json.ToJSON(people);
        return tojson;
    }

I found the solution. You may review the attachment.

commented: Thanks for sharing +14
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.