.submit and executeSql problem

.submit and executeSql problem

Hi, 
i have the following code: 

  1. /******************** campi.js ******************************/
  2. var campi = {};
  3. var dbName = 'mobi-lite';
  4. var db = null;
  5. var html = '';
  6. var id_oggetto = 852;

  7. $(document).ready(function() 
  8. {

  9.     $('#show').click(function() 
  10.     {
  11.        //recupero l'utente loggato e in caso di successo recupero le sue attivita'
  12.        campi.showListaCampi();
  13.     
  14.  

  15.     });       
  16.     
  17.     
  18.      
  19.     
  20. });

  21.              


  22. campi.prova = function(){
  23.             db.transaction(
  24.             function(transaction){ 
  25.             alert('transaction 2'+transaction);
  26.            transaction.executeSql('select NOME_CAMPO, DETTAGLIO, VALORE, OBBLIGATORIO, VISIBILE'+
  27.           ' from R29_CAMPI_CONSUNTIVAZ'+
  28.           ' where ID_OGGETTO in (852,930)',[],function(){alert('transaction callback');} );
  29.            },function(){alert('error');});

  30. }

  31. campi.openDB = function() {
  32.     try 
  33.     {
  34.     
  35.         if (!window.openDatabase) {
  36.             alert('not supported');
  37.         } 
  38.         else {
  39.             var version = '2.0';
  40.             var displayName = 'database mobi html5 Ibrido';
  41.             var maxSize = 65536; // in bytes 
  42.             
  43.             if (db == null) {
  44.               db = openDatabase('mobi-lite', '1.0', 'Database locale Mobi Lite', 200000);
  45.             }
  46.         }
  47.     } catch(e) {
  48.         // Error handling code goes here.
  49.         if (e == 2) {
  50.             // Version number mismatch.
  51.             alert("Invalid database version.");
  52.         } else {
  53.             alert("Unknown error "+e+".");
  54.         }
  55.         return;
  56.     }
  57. }



  58. campi.showListaCampi = function(){

  59.    campi.openDB();
  60.    
  61.    html += '<form id="campiConsuntivazione">';   
  62.    // Intestazione - inizio  
  63.     db.transaction(
  64.    
  65.        function (transaction)
  66.        {
  67.         alert('preselect');
  68.         alert('transaction '+ transaction);
  69.                 transaction.executeSql('select NOME_CAMPO, DETTAGLIO, VALORE, OBBLIGATORIO, VISIBILE'+
  70.                                         ' from R29_CAMPI_CONSUNTIVAZ'+
  71.                                         ' where ID_OGGETTO in (852,930)',[] ,                              
  72.                                         function (transaction, rs)
  73.                                         {
  74.                                         //alert('select eseguita');
  75.                                         //alert('rows: '+     rs.rows.length);
  76.                                           for (var i = 0; i < rs.rows.length; i ++ )
  77.                                            {
  78.                                            //alert('nel ciclo');
  79.                                              
  80.                                              var rw = rs.rows.item(i);
  81.                                               
  82.                                               var nomeCampo = rw['NOME_CAMPO'];
  83.                                               //alert('nome campo '+nomeCampo);
  84.                                               var dettaglio = rw['DETTAGLIO'];
  85.                                               var valore = rw['VALORE'];
  86.                                                                         
  87.                                               html += '<ul>';
  88.                                               html+= '<li>';
  89.                                               html += '<label id = "'+nomeCampo+'">' +nomeCampo+' :  <input id = "'+nomeCampo+'" type="text" value="'+dettaglio+'"></input></label>';
  90.                                               html+= '</li>';
  91.                                               // Campi Attività - fine
  92.                                               
  93.                                              html += '</ul>';
  94.                                              // Riga Attività - fine
  95.                                               
  96.                                               // asyncronous beahviour
  97.                                               
  98.                                            }
  99.                                            html += '<input id="salva" type="submit">Click Me!</input>';   
  100.                                            html += '</form>';
  101.                                            
  102.                                          
  103.                                            
  104.                                            //var node = document.getElementById('LISTA_CAMPI');
  105.                                            
  106.                                            //if (node != null){
  107.                                            //     node.innerHTML = html;
  108.                                            //}
  109.                                            
  110.                                            
  111.                                            // come innerHTML
  112.                                            
  113.                                            campi.prova();
  114.                                            
  115.                                            $("#LISTA_CAMPI").html(html);
  116.                                                                                      
  117.                                            
  118.                                            alert('transaction-.'+transaction);
  119.                                            //gestione bottone salvataggio
  120.                                            $('#salva').click(function(db) 
  121.                                            {
  122.                                             alert('aaa');
  123.                                                     
  124.                                                     $('#campiConsuntivazione').submit(function(db) {
  125.                                                                       alert('----.sdfs-.'+transaction);
  126.                                                                           
  127.                                                                           
  128.                                                                       campi.prova();
  129.                                            
  130.                                              
  131.                                                     });    
  132.                                       
  133.                                           });   
  134.                                               
  135.                                         }
  136.                         
  137.                 //, this.errorHandler
  138.             );                 
  139.         }
  140.    );
  141.    
  142.    //return html;
  143. }
First time campi.prova(); is invoked, it execute the transaction and return the success callback.

When it is execute in Jquery .submit the success callback was not invoked..

Why?

Thanks