From d154c1db31c578e947158d4e534e9be81b80b3dd Mon Sep 17 00:00:00 2001 From: hostfree23434 <46051776+hostfree23434@users.noreply.github.com> Date: Thu, 19 Sep 2024 01:27:13 +0330 Subject: [PATCH] Update script.js --- script.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/script.js b/script.js index 6f12bc1..2a0d5ba 100644 --- a/script.js +++ b/script.js @@ -5,8 +5,20 @@ //xhr.send(); document.addEventListener('DOMContentLoaded', () => { - const dataElement = document.querySelector('[data-bind="text: firstName"]'); - if (dataElement) { - console.log('Data found:', dataElement.textContent); - } + fetch('/ProfileSettings') + .then(response => response.text()) + .then(html => { + const parser = new DOMParser(); + const doc = parser.parseFromString(html, 'text/html'); + + const dataElement = doc.querySelector('[data-bind="text: firstName"]'); + if (dataElement) { + console.log('Data found in y.html:', dataElement.textContent); + } else { + console.log('Element not found in y.html'); + } + }) + .catch(error => { + console.error('Error fetching y.html:', error); + }); });