Friday, 15 July 2016

Update Pannel in MVC 3

In that case what I would do is to add a div with and id which will hold the new data, like: <div id="dataHolder"></div>
Your jQuery should look something like this:
$(function() {
    $("input[type='button']").click(function() { // if your button has an ID value use that instead, like $("#myId")
        $.get(yourUrl, function(data) {
                $("#dataHolder").html(data);
        }

        return false; // to prevent any default action
});
Ideally, your action should return a partial view (or JsonResult if you need to work with JSON data).
public ActionResult MyAction()
{
      // do something

      return PartialView("MyViewThatReturnsSomethingLikeTable", modelDataForMyPartialView);
}

No comments:

Post a Comment