public PartialViewResult GetDatesfromFromDateToDate(DateTime fromDate, DateTime toDate)
where v.VisitingDate >= fromDate && v.VisitingDate <= toDate
@Html.LabelFor(model => model.FromDate)
@Html.TextBoxFor(model => model.FromDate, new { @class = "form-control", type = "text" })
@Html.LabelFor(model => model.ToDate)
@Html.TextBoxFor(model => model.ToDate, new { @class = "form-control", type = "text" })
<input id="Button1" type="button" value="Ok" />
<table class ="table table-bordered table-striped">
<thead>
<tr>
<th style="color:#1a1ae9 ">Visiting Date</th>
<th style="color: #1a1ae9">Customer Name</th>
<th style="color: #1a1ae9">Employee</th>
<th style="color: #1a1ae9">Purpose of Visit</th>
<th style="color: #1a1ae9">Contact Person</th>
<th style="color: #1a1ae9">Description</th>
<th style="color: #1a1ae9">Next Appointment</th>
</tr>
</thead>
<tbody id="visitors">
</tbody>
</table>
My j query code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function () {
$("#FromDate").datepicker({
dateFormat: "dd/mm/yy",
changeMonth: true,
changeYear: true,
});
$("#ToDate").datepicker({
dateFormat: "dd/mm/yy",
changeMonth: true,
changeYear: true,
});
});
</script>
var url = '@Url.Action("GetDatesfromFromDateToDate", "Report")';
var table = $('#visitors');
$("#Button1").click(function () {
var data = { fromDate: $("#FromDate").val(), toDate: $("#ToDate").val() };
$.get(url, data, function(response) {
table.html(response);
}).fail(function() {
// oops
});
});
</script>
this j query code is ot working i inspect the code in browser it will come upto $.get(url, data, function(response) { but it not enter into the loop.
the error is in below image so any one please my j query code and give me correct solution
My partial view
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(m => item.VisitingDate)</td>
<td>@Html.DisplayFor(m=>item.Employee)</td>
<td>@Html.DisplayFor(m=>item.CustomerName)</td>
<td>@Html.DisplayFor(m=>item.POVisit)</td>
<td>@Html.DisplayFor(m=>item.ContactPerson)</td>
<td>@Html.DisplayFor(m=>item.Description)</td>
<td>@Html.DisplayFor(m=>item.NextAppointment)</td>
</tr>
}
Advance thanks..