thankqwerty Posted October 17, 2008 Share Posted October 17, 2008 Hi all, i'm a newbie of javascript. I want to make a treeview showing the structure of my website using javascript. I would like to ask how can i pass the information from mySQL to javascript? Or do i just draw everything (the treeview) using PHP like normal, then expand and close each branch using javascript? Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 17, 2008 Share Posted October 17, 2008 You could use PHP to generate your JavaScript, rather than PHP to generate HTML. Quote Link to comment Share on other sites More sharing options...
thankqwerty Posted October 17, 2008 Author Share Posted October 17, 2008 so i just do it like normal generating html (using echo)? Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 17, 2008 Share Posted October 17, 2008 Yup. Like this: <?php echo "<script type='text/javascript'>\n"; echo "function someFunction(){\n"; // add some JS stuff here echo "}\n"; echo "</script>\n"; ?> Quote Link to comment Share on other sites More sharing options...
thankqwerty Posted October 17, 2008 Author Share Posted October 17, 2008 thank you very much Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.