Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <% using (Html.BeginForm()) { %>
- <p>
- <%=Html.LabelFor(m => m.Username)%>
- <%=Html.TextBoxFor(m => m.Username)%>
- </p>
- <p>
- <%=Html.LabelFor(m => m.Password)%>
- <%=Html.TextBoxFor(m => m.Password)%>
- </p>
- <%} %>
- <script type="text/javascript">
- $("form").submit(function (evt) {
- // extract values to submit
- var form = $(this),
- username = form.find("[name=Username]").val(),
- password = form.find("[name=Password]").val(),
- json = JSON.stringify({
- Username: username,
- Password: password
- });
- $.ajax({
- url: form.attr("action"),
- type: 'POST',
- contentType: 'application/json; charset=utf-8',
- dataType: 'json',
- data: json,
- success: handleLogin
- });
- // stop form submitting
- evt.preventDefault();
- });
- </script>
Add Comment
Please, Sign In to add comment