469,600 Members | 2,444 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,600 developers. It's quick & easy.

how to use php variable in .js file

plz help

I have a php variable $content on page menu.php
now i wnt to use its value on page menu_items.js

hear menu_items.js create a menubar.its contan both static and dynamic menu

my lase menu as vander is dynamic now how can i use this variable on .js

my js file look like

['OUTDOOR LIVING', 'http://www.designresourcestlouis.com/outdoorliving/index.php', null,
['Landscaping', 'http://www.designresourcestlouis.com/outdoorliving/landscaping.php'],
['Pool & Fence', 'http://www.designresourcestlouis.com/outdoorliving/poolfence.php'],
['Hot Tubs', 'http://www.designresourcestlouis.com/outdoorliving/hottubs.php'],
['Decks & Patios', 'http://www.designresourcestlouis.com/outdoorliving/deckspatios.php'],
['Outdoor Furniture', 'http://www.designresourcestlouis.com/outdoorliving/furniture.php'],
['Kitchens & Living Spaces', 'http://www.designresourcestlouis.com/outdoorliving/kitchensliving.php'],
['Sunrooms & Porches', 'http://www.designresourcestlouis.com/outdoorliving/sunrooms.php']
['VENDORS', 'http://www.designresourcestlouis.com/vendors/category.php', null,

in this space i want my variable value

my variable contain value
['1', '../subcategory.php?id=14', null,['111', '../listing.php?id=1', null,],['13', '../listing.php?id=3', null,],['14', '../listing.php?id=4', null,],['fegvrbt5 bh', '../listing.php?id=5', null,],],['2', '../subcategory.php?id=15', null,['111', '../listing.php?id=1', null,],['14', '../listing.php?id=4', null,],],['3', '../subcategory.php?id=16', null,['111', '../listing.php?id=1', null,],['12', '../listing.php?id=2', null,],['13', '../listing.php?id=3', null,],['14', '../listing.php?id=4', null,],],['aa', '../subcategory.php?id=17', null,[';..,/,Ltytryrty', '../listing.php?id=6', null,],],['ankur', '../subcategory.php?id=18', null,['fegvrbt5 bh', '../listing.php?id=5', null,],],['test', '../subcategory.php?id=20', null,[';..,/,Ltytryrty', '../listing.php?id=6', null,],],['tgrhth', '../subcategory.php?id=19', null,['111', '../listing.php?id=1', null,],],
May 9 '07 #1
1 3304
3,237 Expert 2GB
You can do this by having your .js file be a .php file instead. Then when you include it, you can drop your PHP variables in and everything should work fine.
May 9 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Dan Elliott | last post: by
10 posts views Thread by Altman | last post: by
7 posts views Thread by Greg Collins [MVP] | last post: by
4 posts views Thread by thomasp | last post: by
6 posts views Thread by shaun | last post: by
2 posts views Thread by paladin.rithe | last post: by
112 posts views Thread by istillshine | last post: by
11 posts views Thread by Jef Driesen | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.