asp.net MVC partial view

Posted by DotnetSparrow on Stack Overflow See other posts from Stack Overflow or by DotnetSparrow
Published on 2011-03-06T16:02:28Z Indexed on 2011/03/06 16:10 UTC
Read the original article Hit count: 281

Hi all:

I have created a function for load event like this:

$(function() {
  $('#dvGames').load(
     '<%= Url.Action("Partial3", "LiveGame") %>',{ gameDate: '2011-03-06' }
  );
});

and it works. Also, I have created a function for date change like this:

$(function() {
  $('#datepicker').datepicker({
    onSelect: function(dateText, inst) {

        $.ajax({

            type: "POST",

            url: "/LiveGame/Partial3",             

            data: "gameDate=" + dateText,

            success: function(result) {

                alert(result);

                var domElement = $(result); // create element from html

                $("#dvGames").append(domElement); // append to end of list        

            }

        });

    }

  });
});

but it doesnt work. neither it goes in controller action. My controller action is:

 public ActionResult Partial3(string gameDate)
    {

        return PartialView("Partial3");

    }

Please suggest me solution to this.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ASP.NET