MVC  HtmlHelper方法

@using (Html.BeginForm("hours", "create", FormMethod.Post, new  {@class="class1"}))
{
}

传统Form表单Aciton

<form id="form1" method="post" action="~/Hour/Hours" >
    
    @Html.TextBox("Createtime", @DateTime.Now.ToString("yyyy-MM-dd"), new { @style = "height:34px;width:130px;", @class = "Wdate form-control", @onclick = "WdatePicker({dateFmt:'yyyy-MM-dd'})" }) <%-日期控件->

    <button id="submit1" type="submit" class="btn  btn-primary">Search</button>
</form>

前两种用 view()返回

Jquery提交表单

<script type="text/javascript">
    function submit1()
    {        
        $.post("Edit", $("#from1").serialize(), function (data) {
            if (data == "ok") {
                //成功                           
            }
            else {
                //错误
            }
        });
    }
</script>

js的用return Content("ok"); 返回

 

posted on 2017-12-22 14:00  cxd1008  阅读(121)  评论(0编辑  收藏  举报