jquery - Get HTML Divs From PouchDB -


i'm saving html divs pouchdb "board" object. have function of saved divs:

window.viewboards = function() {     var results = db.alldocs({include_docs: true}, function(err, response) { });  } 

the results have divs pretty buried in them:

promise {cancel: function, [[promisestatus]]: "resolved", [[promisevalue]]: object}cancel: function (){return this}__proto__: promise[[promisestatus]]: "resolved"[[promisevalue]]: objectoffset: 0rows: array[5]0: object1: object2: object3: object4: objectdoc: object_id: "2014-12-05t20:48:57.327z"_rev: "1-68823c9c66374d831b482b9a67354301"board: "↵ <div class="square" style="background-color: rgb(162, 136, 99);"></div><div class="square" style="background-color: rgb(25, 108, 184);"></div><div class="square"></div><div class="square"></div><div class="square"></div><div class="square"></div><div class="square"></div><div class="square"></div><div class="square"></div><div class="square"></div><div class="square"></div><div class="square"></div><div class="square"></div><div class="square"></div><div class="square"></div>"__proto__: objectid: "2014-12-05t20:48:57.327z"key: "2014-12-05t20:48:57.327z"value: object__proto__: objectlength: 5__proto__: array[0]total_rows: 5__proto__: object  

how can save "board" object variable put page jquery? tried using dot notation this:

    var board = results.[[promisestatus]]. ??? 

but [[promisestatus]] thing makes tricky , i'm not sure do.

so seeing promise response. pouchdb has 2 ways of working api: callbacks (i.e. function (err, response)) , promises (e.g. db.alldocs().then(function (){...}).

so in case best thing be:

db.alldocs({include_docs: true}).then(function (results) {   /* handle results */  }).catch(function (error) {   /* handle error */ }) 

i suggest take @ the pouchdb guide async code, , if stuck, there lots of live code samples out! :)


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -