MVC: Ajax not executing proper controller action

Below is the ajax script that needs to execute “Bid” action in “Auction” controller. But for some unkonwn reason it is not connecting and gives “Rejected” alret message.


<script type="text/javascript">
    $(function () {
        $('.post-bid').on("click", function () {

            var form = $(this).parent("form");

            $.ajax({
                type: "POST",
                url: 'Auction/Bid',
                dataType: "json",
                data: form.serialize()
            })
                .success(function () {
                    alert("Successful");
                })
                .error(function () {
                    alert("rejected");
                });

            return false;
        });
    });
</script>

Note that the “Bid” action renders html from “_currentprice.cshtml” file.


        [HttpPost]
        public ActionResult Bid()
        {
            return PartialView("_CurrentPrice");
        }

Have you tried using your browser’s developer tools to inspect the ajax request and see what is being returned by the server?