views:

81

answers:

2

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");
}

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

+1  A: 

You need to call $('selector').load(url).

For example:

$('#idOfElementContainingPartialView')
    .fadeOut()
    .load(
        '/ControllerName/GetSomething?parameter=test',
        function() { $(this).fadeIn(); }
    );
SLaks
The fadeout happened after the load when I tried this.
codeulike
+3  A: 

There is a PartialViewResult return type:

public PartialViewResult Details()

Then return a PartialView

return PartialView("ContactList");

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...
});
0bj3ct.m3th0d