how do I get the form data in a javascript object so I can send it as the data parameter of an $.aja

Posted by user281180 on Stack Overflow See other posts from Stack Overflow or by user281180
Published on 2010-05-18T11:08:30Z Indexed on 2010/05/18 12:51 UTC
Read the original article Hit count: 129

Filed under:

How to return json after form.submit()?


 <form id="NotificationForm" action="<%=Url.Action("Edit",new{Action="Edit"}) %>" method="post" enctype="multipart/form-data" onsubmit='getJsonRequestAfterSubmittingForm(this); return false;'>
      <%Html.RenderPartial("IndexDetails", Model);%>
     </form>

 $.ajax({
        url: '<%=Url.Action("Edit","Notification") %>',
        type: "POST",
        dataType: 'json',
        data: $("#NotificationForm").submit(),
        contentType: "application/json; charset=utf-8",
        success: function(result) {
            if (result.Result == true) {
                alert("ghjghsgd");
            }
        },
        error: function(request, status, error) {
            $("#NotSelectedList").html("Error: " & request.responseText);
        }

    });

© Stack Overflow or respective owner

Related posts about asp.net-mvc