10/8/14

how to post form data using ajax call in mvc


If we have to post full form data using AJAX request then we can use

$("form").serialize()

And if we have more than one form on the page  then we need to provide form name in the ajax call

$(document).ready(function () {

        $("#_buttonSearch").click(function () {

            alert("test");

            $.ajax({

                url: "/Home/Search",

                type: 'POST',

                data: $('#test').serialize(),

            });

        });

    });

No comments: