Jquery UI datepicker,点击日期,获取日期并传递给URL

我在事件页面(sharepoint页面)中有一个jquery UI datepicker日历。

$('#datepicker').datepicker(); 

我需要在用户点击任何日期后获取日期并获取该日期并将其作为mypage.aspx?dt = 1/12/2012传递给页面url。我有这个但不能正常工作。

 $('.ui-datepicker td a').click(function(){ var url=$(location).attr('href'); var date = $(this.datepicker( "getDate" )); if(date != 'null') url += '&dt=' + date; window.location.href=url; }); 

这两个都没有..

 $('.ui-datepicker td a').click(function() { window.location.href = 'http://mysite/events/Pages/default.aspx?dt=' + $('#datepicker').datepicker().val(); }); 

有人可以帮忙吗?

尝试

 $('#datepicker').datepicker({ onSelect: function(dateText, inst) { window.location = 'http://mysite/events/Pages/default.aspx?dt=' + dateText; } }); 

使用onSelect事件( 在此处记录 )

允许您在选择日期选择器时定义自己的事件。 该函数接收选定的日期作为文本,并将datepicker实例作为参数。 这指的是相关的输入字段。