checkID: function(id) {
this.db.transaction(function (tx) {
tx.executeSql("SELECT * FROM black WHERE id = ?", [id], function(tx,result){
if (result.rows.length > 0) {
//document.querySelector('#status').innerHTML += '<p>' + result.rows.item(0).link; + '</p>';
answer = {"id": result.rows.item(0).id, "link":result.rows.item(0).link};
} else {
//document.querySelector('#status').innerHTML += '<p>Не найдено</p>';
answer = {"clean": true};
}
},
function (tx, err) {
console.log(err);
}
);
});
},
checkID: function(id, callback) {
this.db.transaction(function (tx) {
tx.executeSql("SELECT * FROM black WHERE id = ?", [id], function(tx,result){
var answer;
if (result.rows.length > 0) {
//document.querySelector('#status').innerHTML += '<p>' + result.rows.item(0).link; + '</p>';
answer = {"id": result.rows.item(0).id, "link":result.rows.item(0).link};
} else {
//document.querySelector('#status').innerHTML += '<p>Не найдено</p>';
answer = {"clean": true};
}
callback(null, answer);
},
function (tx, err) {
callback(err, answer);
}
);
});
},
obj.checkID(id, function(error, answer){
if (!error)
console.log(answer);
});
answers = {
answer = '';
};
checkID: function(id) {
this.db.transaction(function (tx) {
tx.executeSql("SELECT * FROM black WHERE id = ?", [id], function(tx,result){
if (result.rows.length > 0) {
//document.querySelector('#status').innerHTML += '<p>' + result.rows.item(0).link; + '</p>';
answers.answer = {"id": result.rows.item(0).id, "link":result.rows.item(0).link};
} else {
//document.querySelector('#status').innerHTML += '<p>Не найдено</p>';
answers.answer = {"clean": true};
}
},
function (tx, err) {
console.log(err);
}
);
});
},