Page 1 of 1

Database (php) driven javascript

Posted: Thu Oct 09, 2003 7:06 am
by kristian
I have a nice dhtml ticker script that I want to be updated from the database.

Any ideas how I database drive a .js file???

Posted: Thu Oct 09, 2003 7:32 am
by Nay
Javascript can't connect to a database on the server. You'll have to use php to output the Javascript before it gets processed by the browser.

It'll only refresh every time you refresh the file/page.

-Nay

Posted: Thu Oct 09, 2003 7:56 am
by kristian
Would you use PHP to output to the .js file itself. Or would it be better to just inlcude the javascript output directly into the page source.

Posted: Thu Oct 09, 2003 8:30 am
by Nay
I'd say use a .js file if it's not a simple code (validation, etc).

-Nay