控制器:ASP.NET MVC 2:jQuery調用操作,更新視圖?
public ActionResult Index()
{
// not using the interface right now
DealsRepository _repo = new DealsRepository();
var deals = _repo.GetDeals("<Request><ZipCode>92618</ZipCode></Request>");
return View(deals);
}
[HttpPost]
public ActionResult Index(string data)
{
// not using the interface right now
DealsRepository _repo = new DealsRepository();
var deals = _repo.GetDeals(data);
return View(deals);
}
的jQuery:
var url = '<%: Url.Action("Index", "Deal") %>';
var data = '<Request><ZipCode>92618</ZipCode></Request>';
$.post(url, data, function (result) {
alert(result);
});
我想要做的就是刷新(重裝)與更新後的模型查看......我不想使用jQuery更新內容。使用更新後的模型複製視圖。
換句話說,一旦用戶在他們的搜索中輸入了一些改進或者選擇了一個過濾器,我需要撥打電話,然後用最新的Model搜索結果重新加載頁面。
不,我不想用jQuery更新頁面上的內容。我寧願只刷新頁面...這正是我想要完成的。 – dcolumbus 2010-12-09 00:11:19