开发者

jQuery post to method in class

I am开发者_运维问答 in a legacy asp.net application and I need to call a method within a class via jQuery ajax post.

So far I have a class called NewClass with a single method;

    [WebMethod]
    public string jQuery_GetCategoryDescription(string CategoryName)
    {
        return "Slappy";
    }

I then have the following jQuery;

$.post('/NewClass/jQuery_GetCategoryDescription', { CategoryName: "trippy" }, function (newHTML) {
    alert(newHTML);
});

I've tried putting in the whole namespace in.

However I can't seem to call the method within the class.

EDIT

I am getting a 405 error


If the

 [WebMethod]
    public string jQuery_GetCategoryDescription(string CategoryName)
    {
        return "Slappy";
    }

Is in side Index.aspx

You can call it by /Index.aspx/jQuery_GetCategoryDescription

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜