3
請參閱下面的代碼。我叫setQuestion()
內的db.transaction
sucessCallBack但收到此錯誤Uncaught TypeError: this.setQuestions is not a function
。我的代碼中有任何錯誤。請幫幫我。幫助將不勝感激。謝謝成功回調不調用的WebSQL交易的另一個功能
game.module(
"game.scenes.scene"
)
.require(
"game.assets",
"game.entities.gameObject",
"game.entities.backgroundObject",
"game.entities.animeObject",
"game.entities.starObject",
"game.entities.buttonObject"
).body(function() {
game.SceneScene1 = game.Scene.extend({
loaded: function() {
this.get_difficulty_level();
},
setQuestions: function() {
//some code
},
get_difficulty_level: function(){
var app_id = this.app_id;
var user_id = this.user_id;
db.transaction(function (transaction)
{
transaction.executeSql('SELECT * FROM User_report where app_id="'+app_id+'" and user_id="'+user_id+'" order by id desc limit 1;', [],
function (transaction, result)
{
if (result.rows.length == 0)
{
difficulty_level=2;
}else{
difficulty_level = result.rows.item(0).difficulty;
console.log(result.rows.item(0));
}
});
},this.errorHandler,this.successDiffi);
},
successDiffi: function(){
this.setQuestions();
},
});
});
您是否在發佈時遺失了一些代碼? '''.body(function(){'打開一個匿名函數,但是下面的代碼定義了一個對象的屬性。 – puqeko
是的,我錯過了,編輯我的問題 – Vinie