如何处理 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>
使用Ajaxbegin 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" />
}
在控制器中
[HttpPost]
public ActionResult test(string name)
{
return Json(new { retorno = name }, JsonRequestBehavior.AllowGet);
}
如何在 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>
使用Ajaxbegin 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" />
}
在控制器中
[HttpPost]
public ActionResult test(string name)
{
return Json(new { retorno = name }, JsonRequestBehavior.AllowGet);
}