如何从sqlite查询中获取所有行/记录以发布phonegap / cordova

时间:2018-07-12 06:37:09

标签: javascript sql sqlite cordova

我需要从sqlite获取所有实例/行以绑定到发布到远程服务器。我在下面有实现,但是它只显示/获取一行。最终,一旦我能获得所有行,我便希望将其发布。

    <script type="text/javascript"> 
         db.transaction(function(tx) {
            Squery = 'SELECT * FROM records';
                tx.executeSql(Squery,
                    null,
                    function(tx, results)
                    {
                            for(i=0; i<results.rows. length; i++){
                                row = results.rows.item(0);

                    //need all records/rows to show
                    var name = row['name'];
                    var age = row['age'];

                    var dataString = "name=" + name + "&age=" + age;

                      $.ajax({ //Ajax details here
                      });
    //test alert, only shows one row of 'name and age' records, I want a list of all records          
            alert(dataString);
                    return false;   
                            }});
                    });
        </script>

0 个答案:

没有答案