Phonegap API を使用して、カメラで撮影した画像へのパスをデータベースに保存しようとしています。ユーザーからすべてを選択したときに userPic が未定義になる理由が理解できないため、スコープを間違えている可能性があります。同じ方法を使用して、getElement などの .value を使用して名前を保存しようとしています。私は一日中これに対する解決策を見つけようとしています。私はそれを理解することはできません。
var imagePath; // global variable
私のカメラの成功関数では
var placeImage = document.getElementById('placeImage');//Gets the imageholder
placeImage.src = imageURI;//gives image source the
placeImage.style.display = 'block';
imagePath=placeImage.src;// assigns the imageURI to imagePath
console.log(imageURI);// this is logging a path to the image file// etc
そして、db関数への挿入で
var userPic=imagePath;
...
dbtx.executeSql(insertRec, [theName, userPic], queryDB, insFail);