jquery calendarpicker callback pass querystring
Posted
by
user577318
on Stack Overflow
See other posts from Stack Overflow
or by user577318
Published on 2011-01-16T06:50:45Z
Indexed on
2011/01/16
6:53 UTC
Read the original article
Hit count: 277
Trying to use this CalendarPicker source and docs here:
http://bugsvoice.com/applications/bugsVoice/site/test/calendarPickerDemo.jsp
I need to be able to pass the date selected as query string variable of "searchdate" and reload page also updating current date for calendarPicker with querystring date on page reload. This is what I have so far:
jQuery(document).ready(function() {
var calendarPicker = jQuery("#calendarpicker").calendarPicker({
monthNames:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
dayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
years:0,
months:6,
days:5,
showDayArrows:true,
callback:function(cal) {
// Simple output to test calendar date change
jQuery("#output").html("Selected date: " + cal.currentDate.getFullYear()+"-"+cal.currentDate.getMonth()+"-"+cal.currentDate.getDate() );
// Not working well since it also includes arrows from datepicker as selectors
jQuery(".calDay").children().click(function() {
window.location.href="mysite.com?searchdate="+cal.currentDate.getFullYear()+"-"+cal.currentDate.getMonth()+"-"+cal.currentDate.getDate();
});
}
});
Any help greatly appreciated. Can this be done with ajax? I am attempting to update a table of events by datepicker.
© Stack Overflow or respective owner