Try using Weld: https://weld.codeplex.com/
All you have to do is add an attribute to the action of your controller, and Weld will create a typescript proxy.
On its website:
Instead:
[HttpGet] public int Sum(int x,int y) { return x + y; }
and using $ .ajax
var url = "/Home/Sum"; var data = { x: 2 , y: 3}; $.ajax({ url: url, data: data, success: showResult });
Just add the attribute:
[AjaxMethod]
And do it in your typescript:
HomeController.prototype.Sum(2, 3, showResult);
source share