Skip to content
Advertisement

PHP: How to Post date in URL after selecting date in jQuery DateRangePicker?

I am using jQuery DateRangePicker in PHP with one selected date only – Calender UI and trying to fetch data from my MongoDB collection, whenever I select date its value will be alerting and after alerting value should be call in place of $currentdate in $filter = [‘date’ => $currentdate], but filter is define above jQuery code.

PHP Code

JavaScript

HTML Code –

JavaScript

jQuery

JavaScript

Advertisement

Answer

First you have to embed an event on date selection.

JavaScript

Without Ajax

Now suppose you have this form

JavaScript

To trigger a form submission to action_page.php your js will look like this:

JavaScript

With Ajax

While I am not sure to what extended I understood your question. However, I am assuming you trying to check the date against certain logic in the backend. To make it asynchronous (no page refresh) your js will look like the following:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement