Hi!!
I have a ActionResult named "MyPeriods(string dateSelected)" and in the end of it, I have a ViewData["periods"] = listOfPeriods (and after that, I have my return View(), fininshing up my method). When no "date" is passed, "date" is today, otherwise, "date" is the date passed as argument. And this "date" is important to select all the periods and events relationed to it.
So, my ActionResult is sending a list of periods to my View. In my View, I have:
<div id="divEventsPeriods">
<% foreach(UserPeriod period in in (IEnumerable)ViewData["periods"])
Response.Write("<div>PERIOD: " + period.hourBeg + " - " + period.hourEnd + "</div>");
foreach(UserEvents event in period.UserPeriod) {
Response.Write("<div>EVENT: " + event.date + "<br />");
Response.Write("DESCRIPTION: " + event.description + "</div>");
}
%>
</div>
So, when I select a date in jQuery DatePicker, this selected date is passed as an argument to my ActionResult and all the process occurs. And, in the end of all, my page refreshes rendering all the Periods and Events of the selected date. One Period may have many Events.
So, the question is: how can I pass this selected date to my ActionResult, making all process occurs and the page becomes updated without refreshing?
I've tried this on DatePicker onSelect option:
$.ajax({
type: 'GET',
url: '/Admin/Schedule/MyPeriods/?dateSelected=' + dateSelected,
data: dateSelected
});
When I select a date, the $.ajax is called and debugging I could see that the selected date is passed correctly to my ActionResult and process occurs, but the page is not updated.
What am I doing wrong??
Thanks in advance!!