Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function extractDetalisFromDB(){
- db.transaction(queryDB, errorCB);
- }
- // Extracting the relevant data - there is always only one user in the db, hence the 'id=1'
- function queryDB(tx) {
- tx.executeSql('SELECT * FROM currentUser WHERE id=1', [], querySuccess, onError);
- }
- function querySuccess(tx, results) {
- var len = results.rows.length;
- currentUserName = results.rows.item(0).name;
- currentUserEmail = results.rows.item(0).data;
- }
- function validateNewPost() {
- // Here I validate the data from the form... works well.
- if(error_appear === "false") {
- extractDetalisFromDB();
- console.log(currentUserName + ' ' + currentUserEmail); // This is undefined
- var newPostJson = { writer: currentUserEmail, title: title.value, artist: artist.value,
- albumOrSong: albumSong.value, content: content.value, genre:
- genre.value};
- $.post(URLAddress + '/addPost', newPostJson).done(function(data) {});
- window.location = '#index';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement