title: My websql transaction won't execute
body: <p>I have a mobile app in HTML5 that is using the websql database. I have a data.js file with a bunch of functions for doing various CRUD jobs with the database. I've never had this problem until I got to wiring this function. Basically the app is for creating quotes for tradesmen and the function I'm writing is getting the quote and quote lines, converting them into and array of JSON objects and ajaxing them to a web app. </p>
  
  <p>For some reason my db.transaction's are not being executed. Can you help me figure out why? The db exists as other functions are calling this exact SQL. But it works for them and not this one:</p>
  
  <pre><code>function syncQuote(){
      var quote_id = localStorage["quote_id"];
  
      var header = new Array(); // holds id, created, appointment_id
  
      db = openDatabase("Quote", "0.1", "A collection of quotes.", 200000);
  
      if(!db){
          console.log('Failed to connect to database.');
      }
  
      console.log('Getting quote header data.');
      db.transaction(
          function(tx) {
              tx.executeSql("SELECT * FROM quote_header WHERE id = ?", [quote_id],
                  function(tx, results) {
  
                      var len = results.rows.length;
                      for(var i=0; i&lt; len; i++){
                          alert('booyah!');
                          header['quote_id'] = results.rows.item(i).id;
                          header['appointment_id'] = results.rows.item(i).appointment_id;
                          header['created'] = results.rows.item(i).created;
                      }
                  });
          },
          function(tx, error){
              console.log(error.message);
          }
          );
  
       // now get all quote lines for this quote
  
       var lines = new Array();
       console.log('getting quote lines');
       db.transaction(
          function(tx) {
              tx.executeSql("SELECT DISTINCT areas.label as area, features.label as feature, products.label as product, hours, price, colour FROM quote_line JOIN areas ON quote_line.area_id = areas.area_id JOIN features ON quote_line.feature_id = features.feature_id JOIN products ON quote_line.product_id = products.product_id WHERE quote_line.quote_id = ?", [quote_id],
                  function(tx, results) {
  
                      len = results.rows.length;
                      for(var i=0; i&lt; len; i++){
                          var area= results.rows.item(i).area;
                          var feature= results.rows.item(i).feature;
                          var product= results.rows.item(i).product;
                          var hours= results.rows.item(i).hours;
                          var price= results.rows.item(i).price;
                          var colour= results.rows.item(i).colour;
  
                          lines[i] = new Array(6);
                          lines[i][0] = area;
                          lines[i][1] = feature;
                          lines[i][2] = product;
                          lines[i][3] = hours;
                          lines[i][4] = price;
                          lines[i][5] = colour;
  
                      }
  
                  },
  
                  function(tx, error){
                      console.log(error.message);
                  }
              );
          }
      );
  
      var data = new Array(2);
      data[0] = JSON.stringify(header);
      data[1] = JSON.stringify(lines);
  
      alert(data[0]);
      alert(data[1]);
  
      // post data to web app
      var url = "http://*****.com/import_quote";
  
      $.ajax({
        type: 'POST',
        url: url,
        data: data,
        success: quote_sync_success,
        dataType: 'JSON'
      });
  
  }
  </code></pre>
  
  <p>I have both success and fail callbacks but neither is responding.</p>
  
  <p>Also this is the first time I'm posting JSON from a JS app so feel free to comment.</p>
  
  <p>Thanks,</p>
  
  <p>Billy</p>