Hi
I am trying to send a ajax request to set cookies and once the cookies are set then reload the page.
I need this request to be automatically sent as soon as the user select a date from the datepicker.
I have tried the following code but it does not work.
thanks for your help :)
- <script>
- $(function() {
-
- $( '#scheduledOn' ).datepicker({
- showOn: "button",
- buttonImage: "images/calendar.gif",
- buttonImageOnly: true,
- changeMonth: true,
- changeYear: true,
- onSelect: function() {
-
- $.getJSON("ajax/cookies_handler.php", {
- date: $(this).val(),
- action : 'ScheduledOn'
- },function (data) {
-
- console.log(data);
-
- if(data == 'Ok'){
-
- var delay = 500;
- var URL = "index.php";
- setTimeout(function(){ window.location = URL; }, delay);
- }
-
- }
-
- );
-
- }
- });
-
-
-
-
-
- });
-
-
-
- </script>