I'm having a situation and I've got the feeling it's quite simple to fix, but I can't seem to find the right keywords / way to do it.
What I've got
A JQuery Datepicker without a form. It's attached to a span, because I want my calendar to be a menu-item on my website. If I hover/click The 'Calendar' menu-item, the Datepicker shows:
<ul class="menu vertical">
<li>
<span id="datepicker"></span>
</li>
</ul>
What I want / need
I would like to pass the date selected with the datepicker to PHP, so I can use it as a variable elsewhere on the website.
I believe, from other cases, it should be possible with Ajax. But all the examples I find include an input field and/or a submit button. I don't have a form, because I would like to show the datepicker only from the menu.
What would be the best way I can do this?
-- Edit --
Maybe I should give a bit more explanation. I've got images, saved in dd-mm-yy folders. I would like to be able to select a date with the datepicker and then show the images from that folder in a gallery. This is the code for the gallery:
<?php
$date = INPUT FROM DATEPICKER HERE;
$dirname = "images/$date/";
$images = glob($dirname."*.jpg");
echo '<div id="slider" class="flexslider"><ul class="slides">';
foreach($images as $image) {
$titel = basename("$image", ".jpg").PHP_EOL;
echo '<li><img src="'.$image.'" alt="'.basename("$image", ".jpg").PHP_EOL.'"><p class="flex-caption">'.str_replace("_", " ", $titel).'</p></li>';
};
echo '</ul></div>';
?>
onSelectinstead of running the AJAX on a form submit.