Will this js code work in a page template?

First, the two “includes” you gave are going to the same file, so I’m not sure what two files you’re trying to judge against. Secondly, the jquery code is ran AFTER the page is processed, so the php includes will not be available to your jquery object.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)