i want create a triple nested select but first of all i try a simple select.
But the select remain blank.
Can you gime me some hint?
this is my page:
<html><head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="jquery.jcombo.js"></script>
</head>
<body>
<select name="list1" id="list1"></select><br />
<!--<select name="list2" id="list2"></select><br />
<select name="list3" id="list3"></select>-->
<script type="text/javascript">
$( document ).ready(function() {
{
$("#list1").jCombo("getBuilding.php", { selected_value : '1' } );
//$("#list2").jCombo("getStates.php?id_country=", { parent: "#list1" });
// $("#list3").jCombo("getCities.php?id_state=", { parent: "#list2" });
});</script>
</body></html>
where my getBuilding.php is:
<?php
require_once 'dbconnection.php';
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!db_server) die("Unable to connection_aborted to MySQL: " . mysql_error());
mysql_select_db($db_database) or die ("Unable to connection_aborted to MySQL: " . mysql_error());
// Esegui query nel giusto ordine
//(value,text)
$query = "SELECT * FROM Building";
$result = mysql_query($query);
$items = array();
if($result && mysql_num_rows($result)>0) {
while($row = mysql_fetch_array($result)) {
$option = array("id" => $row[0], "value" => htmlentities($row[1]));
$items[] = $option;
}
}
mysql_close();
$data = json_encode($items);
// convertire in formato JSON e stampare
$response = isset($_GET['callback'])?$_GET['callback']."(".$data.")":$data;
echo($response);
?>
this page works. i obtain the data formatted correctly.
[{"id":"1","value":"Building1"},{"id":"2","value":"Building2"},{"id":"4","value":"Building3"},{"id":"5","value":"Building4"}] but it not appear in the select.
Thanks
问题是firefox与jcombo不兼容。它与chrome浏览器兼容!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.