MVC 3 Razor - Ajax.BeginForm OnSuccess

后端 未结 4 1784
忘了有多久
忘了有多久 2020-12-21 06:00

I\'m new to MVC and I\'m trying to update my page after I submit my form; but it\'s not working. I\'m only trying to hide the form, and show the contents of a div OnSuccess

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-21 06:43

    Not working is a problem description that's more adapted to people that don't know/care about how computer works and not software developers. Software developers usually describe precisely the problem they are having. They post the exact error message/exception stack trace they are having.

    This being said you are asking for alternative solutions, here's mine: don't use any MS Ajax.* helpers, use jquery directly and unobtrusively, like this

    
    
    @using (Html.BeginForm())
    {
        
    Message

    @Html.Label("Email", "Email"): @Html.TextBox("Email")

    @Html.Label("Subject", "Subject"): @Html.TextBox("Subject")

    @Html.Label("Message", "Message"): @Html.TextArea("Message")

    }

    Thanks!!!

    Notice how the confirmation paragraph has been externalized from the form.

提交回复
热议问题