Ajax.BeginForm return result and show data appropriate

Posted by niao on Stack Overflow See other posts from Stack Overflow or by niao
Published on 2010-04-21T19:46:03Z Indexed on 2010/04/22 7:23 UTC
Read the original article Hit count: 576

Filed under:
|

I have a from on my page as follows:

    <% using (Ajax.BeginForm("AddAnswer","Marketplace",new AjaxOptions() 
{HttpMethod = "POST" })){ %>

AddAnswer action adds some data to db. What I want to do is: when answer has been successfully added, append #answers div with the current answer passed to controller. When answer has not been successfully added to db - I would like to display appropriate error in #errors div. How can I do this?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about AJAX