View Full Version : including PHP generated array into .js file
03-20-2004, 01:26 PM
I have tried including the following in the .js file:
but this doesn't seem to work.
I know the output of the php file is ok because when I paste its output into the .js file it works fine.
Thank you for any help.
03-20-2004, 02:55 PM
Looks good and is not throwing any errors.
What's with the .php?
03-20-2004, 02:59 PM
03-20-2004, 03:05 PM
the php is there because it is the php file set up to generate and print the needed data.
the js script is basically a hierarchical menu generator in which you are supposed to manually insert the menu elements.
I generated mine using the php script--it prints out this:
but don't know how to get the js file to access the data--the document .write that I used doesn't seem to work...
I will try changing the application type (I know path is ok)
03-20-2004, 03:08 PM
Observe that this is the MIME type I'm talking about, not the contents of the type attribute of the script element. Try this:
03-20-2004, 03:11 PM
sorry, but where is this placed?
Before I echo my data?
03-20-2004, 03:18 PM
Anywhere in the php file.
 Listen to Nightfire, not me...
03-20-2004, 03:25 PM
Should go above anywhere that's printed to the browser, otherwise you get a 'cannot modify header. headers already sent..' error. Next time please only do one thread on the same topic, it's wasting peoples time answering in 2 threads for the same problem
03-20-2004, 03:33 PM
I wan't sure where was best to post (JS or php!)
thank you for your help.
03-20-2004, 03:54 PM
I realize the problem now--I had <br> lines in my code.
Mozilla helped in the debugging.
Many thanks to all of you!
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.