Callback, return value and HTML5 executeSql function

前端 未结 4 1418
轻奢々
轻奢々 2020-12-18 08:19

I have a big problem. I know it\'s about callback, closure but I don\'t know how to solve the problem. Here is my code

$.Model.extend(\'Article\',
{
     fin         


        
4条回答
  •  不思量自难忘°
    2020-12-18 08:47

    The W3C web database spec talks about support for both Asynchronous and Synchronous database operations. (See 4.3 and 4.4)

    If you can't use a synchronous implementation, then you might want to consider approaching the problem like this instead:

    $.Model.extend('Article',
    {
         findAll : function(params, success, error){                
                    var result = []
                    db.transaction(function(tx) {
                        tx.executeSql('select * from contents', [],function(tx, rs) {
                            for(var i=0; i

提交回复
热议问题