我想從特定用戶獲取位置,當我運行此代碼時,它會得到錯誤'Uncaught TypeError:無法讀取未定義' 的屬性'位置',我不知道如何修復。 這是代碼:從sqlite數據庫獲取結果
db.transaction(function(tx){
tx.executeSql("SELECT location FROM users WHERE username='"+username+"'",[], success);
});
function success(tx,results){
var city = results.rows.item[0].location;
}
請將示例代碼作爲[最小,完整,可驗證的示例](https://stackoverflow.com/help/mcve)。 – bignose