Wednesday, August 13, 2014

2. 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" }))





2. 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>