Q:

PDO connection and bootstrap datepicker

I'm using Bootstrap datepicker and it's supposed to grab information about the date from my database when I change the date.
Right now I'm having my jQuery script in jquery call a PHP function with my database query. My question is, though, should I include my PDO connection string in the function or at the top of the site the datepicker is on?
I just started wondering, if I included it in the function, it would create a new PDO connection object on every date change I suppose. I know that an object last till the object is destroyed, but are there no issues leaving it open through the entire page?

A:

but are there no issues leaving it open through the entire page

Yes, leaving the connection open throughout your request has no issues. But closing and recreating a new connection every time your function is called is an issue so avoid that.
Create a connection only once, use it throughout your code on that page.
Note that since you are using a date picker which is almost always front-end JavaScript code, it will make a new AJAX request to your php page everytime you change a date so it will be a new request everytime and your database connection will be opened/closed with each new request. 
If you have your connection on top of the page date picker is on, it can not be shared with a new request just like that using javascript.
Connection in this case has to be on the page which servers the database call on that very request
A little more, to help with your question about closing the connection.
Closing a Connection

Upon successful connection to the database, an instance of the PDO class is returned to your script. The connection remains active for the lifetime of that PDO object. To close the connection, you need to destroy the object by ensuring that all remaining references to it are deleted--you do this by assigning NULL to the variable that holds the object. If you don't do this explicitly, PHP will automatically close the connection when your script ends. 

Persistent connections

Many web applications will benefit from making persistent connections to database servers. Persistent connections are not closed at the end of the script, but are cached and re-used when another script requests a connection using the same credentials. The persistent connection cache allows you to avoid the overhead of establishing a new connection every time a script needs to talk to a database, resulting in a faster web application.

Reference

