<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    come è possibile che non richiama lo script?<br>
    Ciao<br>
    <br>
    <div class="moz-cite-prefix">Il 10/02/2016 14:00, Mirko ha scritto:<br>
    </div>
    <blockquote
cite="mid:CAAtCncNTXCTD1SX_J5JK59HJLhk9rZ_Bkv2sncwoWNs2WG_tPw@mail.gmail.com"
      type="cite">
      <div dir="ltr">Ciao Jusi,
        <div>non ho testato il codice che ci hai girato, però a primo
          impatto ti dico subito che questa operazione:</div>
        <div>
          <div>$('select').each(function(){</div>
          <div>        $(this).change(function() {</div>
        </div>
        <div><br>
        </div>
        <div>puoi riassumerla in $('select').change(function(){}); o
          meglio ancora $('body').on('change','select',function(){});</div>
        <div>Un'altra cosa che ho notato è che nell'attr ID piazzi solo
          un valore numerico, prova ad aggiungere un prefisso tipo
          ilmioid_0.</div>
        <div><br>
        </div>
        <div>prova intanto a modificare queste cose, e piazza un
          console.log qua e la per capire dove si blocca il tuo script</div>
        <div><br>
        </div>
        <div>Ciao!</div>
        <div>Mirko</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">Il giorno 10 febbraio 2016 13:35, Jusi
          Pomenti <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:jusipom@gmail.com" target="_blank">jusipom@gmail.com</a>></span>
          ha scritto:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">ciao a
            tutti,<br>
            è      la prima volta  che affronto un problema del genere e
            ho poca familiarità con jquery e ajax.Non vi invio tutto il
            codice che,oltre  ad essere diviso  in file,è anche
            piuttosto lungo e,in poche parole,funziona  cosi':<br>
            Ho 4 select con id da 0 a 3. Quando l'utente cambia il
            valore della select 0,vengono impostati alcuni parametri per
            operare sulla select 1 e con questi si esegue una richiesta
            AJAX con il metodo GET che popola la select con id 1.<br>
            Stesso discorso quando cambia l'opzione nella select
            2;ovviamente,in questo caso,viene popolata la select 3 La
            mia impressione è che non chiami lo script. Questa è la
            pagina iniziale:<br>
-------------------------------------------------------------------<br>
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
            Transitional//EN" "<a moz-do-not-send="true"
              href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
              rel="noreferrer" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>"><br>
            <html xmlns="<a moz-do-not-send="true"
              href="http://www.w3.org/1999/xhtml" rel="noreferrer"
              target="_blank">http://www.w3.org/1999/xhtml</a>"><br>
            <head><br>
            <meta http-equiv="Content-Type" content="text/html; /><br>
            <title>jquery e ajax</title><br>
            <script src="jquery-1.8-0.min.js" language="javascript"
            type="text/javascript"></script><br>
            <script language="javascript" type="text/javascript"><br>
            <br>
            $(document).ready(function() {<br>
            <br>
                // verifico  quale select ha cambiato  valore e setto,di
            conseguenza,la select da aggiornare<br>
                $('select').each(function(){<br>
                    $(this).change(function() {<br>
                         var list_select_id=$(this).attr('id');    // ID
            select che ha cambiato valore<br>
                         var selectvalue = $(this).val(); // valore
            selezionato<br>
                         var par; // parametri<br>
                         var initial_target_html; // prima opzione<br>
                         switch (list_select_id)<br>
                         {<br>
                             case 0:<br>
                                list_target_id='#1';<br>
                                initial_target_html = '<option
            value="0">Seleziona una categoria</option>';<br>
                                par='id_cat='+seletvalue;<br>
                                break;<br>
                            case 2:<br>
                                list_target_id='#3';<br>
                                initial_target_html = "<option
            value='0'>Seleziona un'area/option>";<br>
                                par='id_area' + seletvalue;<br>
                                break;<br>
                         }<br>
            <br>
             alert(list_target+" - "+par);<br>
                         $(list_target_id).html(initial_target_html); //
            inserisce la prima opzione nel secondoo menù<br>
            <br>
                         $('#'+list_select_id).change(function(e) {<br>
                             // visuualizza un messagio in attesa di
            caricaree u  dati<br>
                             $(list_target_id).html('<option
            value="0">Sto caricando</option>');<br>
                             //if-else<br>
                             if (selectvalue == "") {<br>
                                 // Se non è selezionata um'opzione nel
            primo menù,neò secondo viene visualizzata la prima opzione<br>
                               
             $(list_target_id).html(initial_target_html);<br>
                             } else {<br>
                                 // richiest AJAX con GET<br>
                                 $.ajax({url: 'ajax-scat.php?'+ par,<br>
                                     success: function(output) {<br>
                                         // visualizza le opzioni in
            caso di successo<br>
                                         $(list_target_id).html(output);<br>
                                     },<br>
                                     error: function (xhr, ajaxOptions,
            thrownError) {<br>
                                         // visualizza eventuali errori<br>
                                         alert(xhr.status + " "+
            thrownError);<br>
                                     }<br>
                                 }); // chiudo $.ajax<br>
                             } //if-else<br>
                         }); // chiudo $(list_select_id).change(<br>
            <br>
                    });// chiudo $(this).change(<br>
                });// chiudo $('select').each(<br>
            <br>
            }); //chiudo ready<br>
            <br>
            </script><br>
            </head><br>
            <body><br>
            <div style='position:absolute; top:150px; left:100px;
            width:900px; height:200px'><br>
            <?php<br>
              include ("config_db.php");  // funzioni per la connessione
            al db<br>
              include ("php_html.php");   // scrive codice html tramite
            php<br>
              $db=connect();<br>
             
            $m_cat=crea_menu($db,"categorie","cat","index.php",0,0,"cat");<br>
             
            $m_area=crea_menu($db,"area","area","index.php",0,2,"area");<br>
              mysql_close($db);<br>
              $m_scat=crea_menu_nill(1,"scat");<br>
              $m_uff=crea_menu_nill(3,"uff");<br>
              $s="<form  name='ins' method='post' action=''>";<br>
              $s.="<table width='100%'>";<br>
              $s.="<tr height=50>";<br>
              $s.=ins_menu("Categoria
            :","5%",1,$m_cat,"30%",1,"top","","","",0);<br>
              $s.=ins_menu("Sottocategoria
            :","5%",1,$m_scat,"30%",1,"top","","","",0);<br>
              $s.="</tr>";<br>
              $s.="<tr height=50>";<br>
              $s.=ins_menu("Area
            :","5%",1,$m_area,"30%",1,"top","","","",0);<br>
              $s.=ins_menu("Ufficio
            :","5%",1,$m_uff,"30%",1,"top","","","",0);<br>
            <br>
              $s.="</tr></table>";<br>
            <br>
              $s.=ins_submit();<br>
              $s.="</form>";<br>
              echo $s;<br>
            <br>
            ?><br>
            </div><br>
            </body><br>
            </html><br>
            ----------------------------------------------<br>
            dove  sbaglio?<br>
            Ciao e grazie<br>
            <br>
            _______________________________________________<br>
            <a moz-do-not-send="true" href="http://www.llg.it"
              rel="noreferrer" target="_blank">http://www.llg.it</a><br>
            latina mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:latina@lists.linux.it" target="_blank">latina@lists.linux.it</a><br>
            <a moz-do-not-send="true"
              href="http://lists.linux.it/listinfo/latina"
              rel="noreferrer" target="_blank">http://lists.linux.it/listinfo/latina</a><br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
<a class="moz-txt-link-freetext" href="http://www.llg.it">http://www.llg.it</a>
latina mailing list
<a class="moz-txt-link-abbreviated" href="mailto:latina@lists.linux.it">latina@lists.linux.it</a>
<a class="moz-txt-link-freetext" href="http://lists.linux.it/listinfo/latina">http://lists.linux.it/listinfo/latina</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
-------------------------------
Junior Silvestro Pomenti
Latina

Sito Web: <a class="moz-txt-link-abbreviated" href="http://www.jusipom.it">www.jusipom.it</a>
Email: jusipom(at)gmail.com
       info(at)jusipom.it
-------------------------------</pre>
  </body>
</html>