asp.net mvc的jQuery的 - 显示部分页面返回结果? [英] asp.net mvc jquery - display partial page as return result?

查看:168
本文介绍了asp.net mvc的jQuery的 - 显示部分页面返回结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用jQuery的,是它可以调用 / ControllerName / GetSomething?参数=测试,而在 GetSomething 方法我有以下:

With jQuery, is it possible to call /ControllerName/GetSomething?parameter=test, while in GetSomething method I have following:

public ActionResult Details()
{
    filterQuery.OrderBy = Request.QueryString["parameter"];

    var contacts = contactRepository.FindAllContacts(filterQuery).ToList();

    return View("ContactList");
}

然后ContactList.ascx的淡出当前的显示与更新某一替代它?

and then fadeOut current display of ContactList.ascx replacing it with updated one?

推荐答案

有一个PartialViewResult返回类型:

There is a PartialViewResult return type:

public PartialViewResult Details()

然后返回PartialView

Then return a PartialView

return PartialView("ContactList");

在jQuery的,使用load()方法来检索使用AJAX的结果,然后使用jQuery的淡入(),淡出(),和fadeTo的某种组合()方法。

In jQuery, use the load() method to retrieve the results using AJAX and then use some combination of the jQuery fadeIn(), fadeOut(), and fadeTo() methods.

$('#result').load('/ControllerName/GetSomething?parameter=test', function() {
  $('#result').fadeOut etc...
});

这篇关于asp.net mvc的jQuery的 - 显示部分页面返回结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆