我可以在一個javascript文件之間使用php嗎? 我的JavaScript文件還有更多的功能從PHP腳本 這是我的JS文件我可以在.js文件中包含一個php腳本嗎?鏈接下拉
var hide_empty_list=true;
addListGroup("vehicles", "Area");
addList("Area", "Select a Area", "", "dummy-maker");
addList("Area", "Alappakkam", "Alappakkam", "Alappakkam");
addList("Area", "Porur", "Porur", "Porur");
addList("Area", "Vanagaram", "Vanagaram", "Vanagaram", 1);
addList("Alappakkam", "Select Volunteer", "", "dummy-Alappakkam");
addList("Alappakkam", "Monish", "car", "Alappakkam-Cars");
addList("Alappakkam", "Kala", "suv", "Alappakkam-SUVs/Van");
addList("Alappakkam", "Akil", "truck", "Alappakkam-Trucks", 1);
addList("Porur", "Select Volunteer", "", "dummy-honda");
addList("Porur", "Srinivasan", "car", "Honda-Cars");
addList("Porur", "Lingesh", "suv", "Honda-SUVs/Van", 1);
addList("Porur", "Akash", "suv", "Honda-SUVs/Van", 1);
addList("Porur", "Prakash", "suv", "Honda-SUVs/Van", 1);
addList("Vanagaram", "Select Volunteer", "", "dummy-chrysler");
addList("Vanagaram", "Sudharshan", "car", "Chrysler-Cars", 1);
addList("Vanagaram", "Sarath", "suv", "Chrysler-SUVs/Van");
而且我的PHP腳本是
<?php
# here database details
@mysql_connect('mysql.hostinger.in', 'u467215xxx_xxxx', 'xxxxxxx');
@mysql_select_db('u467215728_chnai');
$sql = "SELECT address FROM member ";
$result = mysql_query($sql);
echo "<select name='address'>";
while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['address'] ."'>" . $row['address'] ."</option>";
}
echo "</select>";
?>
其實我想在這裏做的是從獲取數據我數據庫並進入下拉菜單。我完成了一個單一的下拉腳本,但實際上鍊接下拉。
您是否嘗試過改變從'.js'文件類型爲'.php'? (和更改'src'屬性指向新的文件擴展名) – Terminus
我想你不明白我的問題兄弟..我想合併該PHP腳本與JS腳本.. – Monish
我想我沒有。有什麼你認爲你可以添加澄清或這是儘可能多的解釋,你可以給? – Terminus