CatalinRadoi
7/24/2015 - 12:43 PM

How to Fill a div with an ajax call?

How to Fill a div with an ajax call?

  1. By using Ajax.BeginForm
using (Ajax.BeginForm("NavigatePage", "Case", null, new AjaxOptions {  
InsertionMode = InsertionMode.Replace, 
 UpdateTargetId = "caseList",  
HttpMethod = "POST" }, new { @role = "form" }))
  1. By using jQuery
<script type="text/javascript">
    $(document).ready(function () {
        $('.caseListTable tbody tr').click(function () {
            var caseNumber = $(this).children(":first").text();
            var url = "@Html.Raw(Url.Action("GetCaseDetails"))" + "?caseNumber=" + caseNumber;

            $.get(url, function(data) {
                $("#caseDetails").html(data);
            });
        });
    });
</script>