$("select[name=idSites]").change(function(){
document.getElementById("elementos").disabled=true;
id = $('select[name=idSites]').val();
$("#elementos").load('utils/genera-selectElementos.php?id='+id);
document.getElementById("elementos").disabled=false;
});
--------------------------------------------------------------------------------------------------------
require_once('../conexion/conexion.php');
session_start();
global $dbu;
if (isset($_GET['id'])) {
$query = "SELECT * FROM cat_equipos WHERE bandActivo = '1' AND idSites = '".$_GET['id']."' ORDER BY nombre";
$rs = $dbu->FetchOne($query,"obj");
if ( $rs ) {
echo '<optgroup label="Equipo">';
while ( !$rs->EOF ) {
echo '<option value="2-'.$rs->fields['idEquipos'].'">'.$rs->fields['nombre'].'</option>';
$rs->movenext();
}
}
$query = "SELECT * FROM cat_servidores WHERE bandActivo = '1' AND idSites = '".$_GET['id']."' ORDER BY nombre";
$rs = $dbu->FetchOne($query,"obj");
if ( $rs ) {
echo '<optgroup label="Servidores">';
while ( !$rs->EOF ) {
echo '<option value="3-'.$rs->fields['idServidores'].'">'.$rs->fields['descripcion'].'</option>';
$rs->movenext();
}
}
$query = "SELECT * FROM cat_aplicaciones WHERE bandActivo = '1' AND idServidores IN (SELECT idServidores FROM cat_servidores WHERE idSites = '".$_GET['id']."') ORDER BY nombre";
$rs = $dbu->FetchOne($query,"obj");
if ( $rs ) {
echo '<optgroup label="Aplicaciones">';
while ( !$rs->EOF ) {
echo '<option value="4-'.$rs->fields['idAplicaciones'].'">'.$rs->fields['nombre'].'</option>';
$rs->movenext();
}
}
}