Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
hostfree23434 authored Sep 18, 2024
1 parent d61d199 commit d154c1d
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

0 comments on commit d154c1d

Please sign in to comment.