jQuery的负载asp.net MVC局部视图 [英] jquery load with asp.net MVC partial view
本文介绍了jQuery的负载asp.net MVC局部视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个局部视图,我想使用jQuery来呈现在主视图。
I have a partial view and I want to render it in main view using jquery.
下面是如何我编码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"); %>
和它的作品,但我想,所以我使用jquery load方法来过滤局部视图的数据。
and it works but I want to filter data in partial view so I am using jquery load method.
推荐答案
您控制器操作,您需要调用Ajax请求时,需要提供一个DateTime参数:
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' }
);
});
这篇关于jQuery的负载asp.net MVC局部视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文