title: using jQuery UI autocomplete with webSQL and JSON object array
body: <p>So this one is killing me..</p>
  
  <p>I'm trying to use the jQuery UI autocomplete plugin to work with a webSQL table. The problem I'm having is that I need to grab two fields from the json object array; An id field and a name field and push them into a JSON object array and then bind it to the autocomplete plugin.</p>
  
  <p>When the user types in the autocomplete input field they should only see the name field and the id field should be set into a variable when a name is selected.</p>
  
  <p>Below is an example that I have:</p>
  
  <pre><code>    var allFields = [];
  
      db.runInTxn({
          dbAction: function (txn) {
              txn.executeSql('SELECT &lt;Id&gt;, &lt;Field1&gt;, &lt;Field2&gt; FROM &lt;Table&gt;', null, function (txn, resultSet) {
                  var rows = resultSet.rows;
                  for (var i = 0; i &lt; rows.length; i++) {
                      var row = rows.item(i);
                      allFields.push(
                           {1: row.&lt;Id&gt;, 2: row.&lt;Field1&gt;, 3: row.&lt;Field2&gt;}
                      );
  
                  }
  
              }, function (txn, error) {
                  console.log('Select error.', error);
              });
          }
      });
  
      //autocomplete field1 input
      $("#field1").autocomplete({
          source: allFields, 
          select: function (event, ui) {
              alert(ui.&lt;Id&gt;);
              //return false;
          }
      });
  </code></pre>
  
  <p>This doesn't work. Any help would be greatly appreciated.</p>