MVC partial page update
Posted
by GB
on Stack Overflow
See other posts from Stack Overflow
or by GB
Published on 2010-03-26T20:57:47Z
Indexed on
2010/03/26
21:13 UTC
Read the original article
Hit count: 202
Hello,
I have an MVC project where I have a form with fields a user can enter and save. On that same page I have a table which shows a brief listing of information that the user just saved. The problem I am having is trying to update only the table after a save and not an entire page refresh.
Is this possible in jquery or MVC? If so does anyone have an example.
Here is what the action in the controller looks like:
public ActionResult RefreshList()
{
string _employeeID = Request.QueryString["empIDSearch"];
this.ViewData["coursehistorylist"] = _service.ListCoursesByEmpID(_employeeID);
return View("CourseHistoryList");
}
The function in the view: (and this is where I'm confused on how to update only the table)
$.ajax({
url: "/Home/RefreshList",
type: "POST",
success: function(result) {
alert("got here");
},
error: function(xhr, ajaxOptions, thrownError) {
alert(xhr.status + " " + thrownError + " " + ajaxOptions);
}
});
Thanks.
© Stack Overflow or respective owner