3

Can't seem to find any example on how to call generic method with type from javascript using ajax

    public virtual JsonResult GetData<T>(SomeClass firstParam) where T : class, ISomeInterface
    {
       ...
    }

Call with ajax

    ...
    ajax:
        {
            url: "@Url.Action("GetData", "Controller")",
            type: "POST",
        },
    ...

Edit 1: Just to clarify duplicate report. I'm trying to call generic method not controller so something like this

 ...
    ajax:
        {
            url: "@Url.Action<SomeClass>("GetData", "Controller")",
            type: "POST",
        },
    ...
2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.