I am using the jQuery UI datepicker widget and I would like to see if a request variable is set. When someone selects a date, a request variable date
is set using window.location.replace()
. After the replace()
, I would like to use the setDate
method to set the date, if the date
variable is set, otherwise just use today's date.
Asked
Active
Viewed 43 times
1

Trufa
- 39,971
- 43
- 126
- 190

Matt Altepeter
- 317
- 2
- 5
- 17
-
Can you make a http://jsfiddle.net example? I'm not quite sure what you need. – Trufa Feb 11 '13 at 18:21
-
http://jsfiddle.net/p7Wjc/ When the date is clicked, a URL parameter gets added and the page is reloaded using `replace()`. I need to know if the parameter is set and get the value of the parameter – Matt Altepeter Feb 11 '13 at 18:25
-
@SalmanA I found this: http://stackoverflow.com/questions/6001839/check-whether-a-url-variable-is-set-using-jquery But when I tried to implement it it broke my jQuery UI datepicker. Could you give me a hint on how to implement it? Should it be in the `$(document).ready()` or? – Matt Altepeter Feb 11 '13 at 18:27
-
1`var qs_date = location.href.match(/[?&]date=([^]+)/); if(qs_date) qs_date = qs_date[1];` – Salman A Feb 11 '13 at 18:36