/ Published in: C#

How to submit a form asynchronously and get result in JSON
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
@section Scripts { <script type='text/javascript'> function onSucces(content) { $("#result").text(content.Result); } </script> } @using (Ajax.BeginForm("Subscribe", "Home", new AjaxOptions() { OnSuccess = "onSucces", LoadingElementId = "loader" })) { @Html.TextBoxFor(s => s.EmailAddress); <input type="submit" value="button" /> <div id="loader" style="display:none">Even wachten!</div> <div id="result"></div> }
Comments
