Advertisement
Guest User

Untitled

a guest
Jul 12th, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. function extractDetalisFromDB(){
  2. db.transaction(queryDB, errorCB);
  3. }
  4.  
  5.  
  6. // Extracting the relevant data - there is always only one user in the db, hence the 'id=1'
  7. function queryDB(tx) {
  8. tx.executeSql('SELECT * FROM currentUser WHERE id=1', [], querySuccess, onError);
  9. }
  10.  
  11.  
  12. function querySuccess(tx, results) {
  13. var len = results.rows.length;
  14. currentUserName = results.rows.item(0).name;
  15. currentUserEmail = results.rows.item(0).data;
  16. }
  17.  
  18. function validateNewPost() {
  19. // Here I validate the data from the form... works well.
  20.  
  21. if(error_appear === "false") {
  22. extractDetalisFromDB();
  23. console.log(currentUserName + ' ' + currentUserEmail); // This is undefined
  24. var newPostJson = { writer: currentUserEmail, title: title.value, artist: artist.value,
  25. albumOrSong: albumSong.value, content: content.value, genre:
  26. genre.value};
  27.  
  28. $.post(URLAddress + '/addPost', newPostJson).done(function(data) {});
  29. window.location = '#index';
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement