繁体   English   中英

如何处理 asp.net MVC c # 中的发送参数按钮?

[英]How to handle a send parameter button in asp.net MVC c #?

如何处理 asp.net MVC c # 中的发送参数按钮?

<form id="form" name="form" action="" method="post">
    <label>Nom : </label>
    <input type="text" id="NAME" name="NAME" class="form-control"  value=@Model.NAME required />
    <input type="submit" value="importer  />
</form>

使用 Ajax begin Form 获取

在 Html

      @using (Ajax.BeginForm("test", "Inicio", new AjaxOptions { HttpMethod = "Post", OnSuccess = "Sucesso(data);" }))
      {
        <label>Nom : </label>
        <input type="text" id="name" name="name" class="form-control" required />
        <input type="submit" value="importer" />
      }

在 controller

    [HttpPost]
    public ActionResult test(string name)
    {
        return Json(new { retorno = name }, JsonRequestBehavior.AllowGet);
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM