Ajax Call
<div id="partialSummaryDiv">@{Html.RenderPartial("CalendarPartialView");}</div>
<script type="text/javascript">
function SearchByMonth()
{
var x = document.getElementById("MonthInputField");
if (x.value != "") {
$.ajax({
url: '/Employees/SearchWholeMonth',
type: 'GET',
data: { "month": x.value, "id": @y },
error: function (data) {
alert('Error!');
},
success: function (data) {
$('#partialSummaryDiv').html(data);
alert("succes");
}
});
}
else {
alert('Date not selected!')
}
}
</script>
Controller
[HttpGet]
public PartialViewResult SearchWholeMonth(DateTime month,int id)
{
...calculations
return PartialView("CalendarPartialView", TotalList);
}
So i have this ajax call and the controler with the partial view. I ran the controller code with breakpoints and the calculations and returned results are correct. The problem is that after i press the buttos there are no results,no errors. In the developer console on network the request has code 200 for OK and there are also no errors there. The ajax function does not enter succes and nothing is shown in the end. Please help! Ty
In the partial view i also have
@model List<float>
and i am showing the results like this
@String.Format("{0} {1}", @i, @Model[j])
EDIT!!!!!!!!!!!!!!!!!!!!: The ajax/view/controller works fine but the partial view is not rendering on the details page! I have tried to render it on a different page and it works there. How can i make it render on the Details page!