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",
        },
    ...
Stack Rawe
  • 31
  • 3
  • Possible duplicate of [In asp.net mvc is it possible to make a generic controller?](http://stackoverflow.com/questions/848904/in-asp-net-mvc-is-it-possible-to-make-a-generic-controller) – teo van kot Mar 07 '17 at 08:22
  • See edit 1 for duplicate clarification – Stack Rawe Mar 07 '17 at 11:54

0 Answers0