An ajax call will open a new HTTP connection by it self. It is no different than an ordinary request to your server in terms of connecting. Bare in mind though, that you need to initialize connections to databases again in the script that is to be called dynamically because, as I said, it is treated as a separate request, which it actually is, therefore you need to re-initialize everything that you need to use.
Best of luck! :P