Home > Web Front-end > HTML Tutorial > About the use of JS rollback function_html/css_WEB-ITnose

About the use of JS rollback function_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:45:19
Original
1114 people have browsed it

this.query = function(callback){
db.transaction(function (tx) {
tx.executeSql("select * from transaction_record", [],
function (tx, results) {
len = results.rows.length;
if(len>0){
for (i = 0; i < len; i ){
var row = results.rows.item (i);
console.log('id: ' row.id);
console.log('name: ' row.name);
if(typeof(callback) = = 'function') {callback(results.rows)}
}else{
if (typeof(callback) == 'function') {callback(false)} //No data
}
}, function (tx, error) {
return false;
console.log('Query failed: ' error.message);
});
});
}

As shown in the above code: How to call the above method to get the return value? ? ?


Reply to discussion (solution)

xxxx.query(function (rows){

// Use rows here to get the return value
});

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template