English 中文(简体)
是否有一个项目,由汽车现代化的JavaScript代典代典代典代典代号来命名协会。 NET MVC的行动方法?
原标题:Is there a project that auto-generates JavaScript proxy code to call ASP.NET MVC action methods?

是否有带现有控制器、分析其公共行动方法并生成 Java本代典的代号的密码,以便它能够轻易地被其他 Java印法所称作吗? 我已经知道,我们可以利用支部来支付一笔钱和一笔钱,用于称我们的亚克斯服务,但我认为,这一进程可以简化,不必具体指明美国宇宙航空研究开发机构网络服务的相对长度和每个参数投入的参数名称。

例如,我要说,我们有以下C#控制器:

public class CustomerController : Controller
    {

        public JsonResult Create(string name, string address)
        {
            return new JsonResult {Data = 11111};
        }

        public JsonResult Update(int id, string name, string address)
        {
            return new JsonResult {Data = true};
        }
    }

I would like to call the controller s AJAX action methods by using the following fashion.

Proxy.Customer.Create("Scott Gu", "Somewhere in Redmond").done(function(id) {
      /* id is an int and not an string */
      Proxy.Customer.Update(id, "Scott Gu", "Somewhere in Seattle");
});

是否存在一个允许我这样做的项目?

<>Update>

它没有我要求的项目。 除了“信号”之外,一些可能使用的是Phil Haack的主计长项目。 它可以检查任何特定的控制器,并揭示它拥有何种行动方法、它接受的参数、其类型等。

The following link contains the getter method for retrieving a details about a given controller. https://github.com/Haacked/CodeHaacks/blob/master/src/MvcHaack.ControllerInspector/ControllerDetailer.cs

Update 2

Doh. Phil Haack已经开发出 Java代号。 可见here

最佳回答
问题回答

Phil Haack有一个满足我需求的项目。 这仍然需要将每个参数输入与参数名称相配。 http://haacked.com/archive/08/18/questing-asp-net-mvc-action-methods- from-javascript.aspx”rel=“nofollow”>tutorial 。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签