From e020dc89ec9bcd5a8306498795a47cb740907d4a Mon Sep 17 00:00:00 2001 From: Ahmedvolga Date: Mon, 30 Sep 2024 11:51:49 +0300 Subject: [PATCH] fix username to dataset --- static/js/citydetails.js | 5 +++-- static/js/diag.js | 2 +- views/home.ejs | 4 +--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/static/js/citydetails.js b/static/js/citydetails.js index a6e84d3..ad86494 100644 --- a/static/js/citydetails.js +++ b/static/js/citydetails.js @@ -182,8 +182,9 @@ function loadCityDetails() { $(document).ready( function() { document.getElementById('downloadButton').addEventListener('click', async () => { // const filename = 'testfilename'; - const username = document.getElementById("userName").innerText; - + + const username = document.getElementById("userName").dataset.username; + const filename = getCityDetails()+' '+ username +'.xlsx'; console.log(filename); diff --git a/static/js/diag.js b/static/js/diag.js index 351e1f4..2355379 100644 --- a/static/js/diag.js +++ b/static/js/diag.js @@ -313,7 +313,7 @@ $('#copyText').click(function () { saveToLocalStorage(); - const userName = document.getElementById("userName").innerText; + const userName = document.getElementById("userName").dataset.username; console.log("userName ", userName); diff --git a/views/home.ejs b/views/home.ejs index dfcfed5..a79c0ef 100644 --- a/views/home.ejs +++ b/views/home.ejs @@ -88,9 +88,7 @@
User Photo -
- <%= username %> -
+
Display Username
  Profile