7

I have a partial view and I want to render it in main view using jquery.

Here is how I am coding the jQuery:

$(document).ready(function() {
        $("#dvGames").load("/LiveGame/Partial3");
});

where as controller method looks like this:

public ActionResult Partial3(DateTime gameDate)
{
    return View("Partial3");
}

I dont see anything. I tried

<% Html.RenderPartial("Partial3"); %> 

and it works but I want to filter data in partial view so I am using jquery load method.

Jeff LaFay
  • 12,882
  • 13
  • 71
  • 101
DotnetSparrow
  • 27,428
  • 62
  • 183
  • 316

2 Answers2

15

Your controller action requires a DateTime parameter that you need to supply when invoking the AJAX request:

$(function() {
    $('#dvGames').load(
        '<%= Url.Action("Partial3", "LiveGame") %>', 
        { gameDate: '2011-03-06' }
    );
});
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
0

Try letting the framework create the URL. Use the

<%= Url.Action("LiveGame","Partial3") %>
rcravens
  • 8,320
  • 2
  • 33
  • 26