Database (php) driven javascript

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kristian
Forum Newbie
Posts: 10
Joined: Tue Jul 29, 2003 1:21 pm

Database (php) driven javascript

Post 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???
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post 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
kristian
Forum Newbie
Posts: 10
Joined: Tue Jul 29, 2003 1:21 pm

Post 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.
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

I'd say use a .js file if it's not a simple code (validation, etc).

-Nay
Post Reply