我真的很希望有人能指出我正确的方向,因为我对js很陌生。从js和php数据库中获取信息
我有一个下拉菜单的内容被填充如下。
var anylinkmenu1={divclass:'anylinkmenu', inlinestyle:'', linktarget:''}
anylinkmenu1.items=[
["Page 2 Subpage 1", "http://kellys-webdesigns.com/mpanetwork/index.php? id=8"],
["Page 2 Subpage 2", "http://kellys-webdesigns.com/mpanetwork/index.php? id=9"],
["Page 2 Subpage 3", "http://kellys-webdesigns.com/mpanetwork/index.php? id=10"],
["Page 2 Subpage 4", "http://kellys-webdesigns.com/mpanetwork/index.php? id=11"],
["Page 2 Subpage 5", "http://kellys-webdesigns.com/mpanetwork/index.php? id=12"],
["Page 2 Subpage 6", "http://kellys-webdesigns.com/mpanetwork/index.php? id=13"],
["Page 2 Subpage 7", "http://kellys-webdesigns.com/mpanetwork/index.php? id=14"],
["Page 2 Subpage 8", "http://kellys-webdesigns.com/mpanetwork/index.php? id=15"]
]
var anylinkmenu2={divclass:'anylinkmenu', inlinestyle:'', linktarget:''}
anylinkmenu2.items=[
["Page 3 Subpage 1", "http://kellys-webdesigns.com/mpanetwork/index.php? id=16"],
["Page 3 Subpage 2", "http://kellys-webdesigns.com/mpanetwork/index.php? id=17"],
["Page 3 Subpage 3", "http://kellys-webdesigns.com/mpanetwork/index.php? id=18"],
["Page 3 Subpage 4", "http://kellys-webdesigns.com/mpanetwork/index.php? id=19"],
["Page 3 Subpage 5", "http://kellys-webdesigns.com/mpanetwork/index.php? id=20"],
["Page 3 Subpage 6", "http://kellys-webdesigns.com/mpanetwork/index.php? id=21"],
["Page 3 Subpage 7", "http://kellys-webdesigns.com/mpanetwork/index.php? id=22"],
["Page 3 Subpage 8", "http://kellys-webdesigns.com/mpanetwork/index.php? id=23"]
]
内容是数据库的一部分,而不是我手动将这些数值希望他们从数据库中取出,这可能吗?我想我需要使用PHP来实现这一点,我没有问题的PHP代码,我只是不知道如何连接到PHP的JS。
任何帮助将不胜感激。
对不起是一个痛苦,但我在上面的代码中得到一个语法错误,我无法找到它为我的生活,任何想法?谢谢 – 2012-08-09 08:37:38
我的道歉我错过了在if语句回声结束时的分号。在我的答案中已修复。 – Bigmack 2012-08-09 09:05:21