Hi my j query code is not working correctly. I will explain my issue with eg.I have 2 fields FromDate ,ToDate and one button in my view. if i select the FromDate ,ToDate and click the button means it want to diaplay the data in the same view based Date Selection
Example Output
My Main View
This is my main view if i select the From date and todate and click the ok button it have to list the data in the same view under From and to date the list of data is mentioned in the below image
I want to bring the output same as like which is mentioned in the above Example output. That is if i select the From Date and To Date and Click the ok button it need to display the particular fields from( View_Visitorsform)based on From Date and ToDate selection. This is my task . so i used partial view to get the list of data .
My controller Code
public ActionResult DailyVisitReport()
{
return View();
}
public PartialViewResult GetDatesfromFromDateToDate(DateTime fromDate, DateTime toDate)
{
List model = (from v in db.View_VisitorsForm
where v.VisitingDate >= fromDate && v.VisitingDate <= toDate
select v).ToList();
return PartialView("_Visitors", model);
}
My Main View
@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" })
@Html.TextBoxFor(model => model.ToDate, new { @class = "form-control", type = "text" })
| Visiting Date | Customer Name | Employee | Purpose of Visit | Contact Person | Description | Next Appointment |
|---|
My j query code
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
});
});
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)
{
}
Advance thanks..

Manimekalai GanesanRank #1,304 · 1.3K reputationPosted Apr 2, 2016, 2:22 AM EDT
Sneha KRank #2,496 · 563 reputationPosted Apr 2, 2016, 2:26 AM EDT