I'm trying to get the href
of <span id="username">
from another page on my website.
The jQuery:
var fetchedInfo;
$.get("./profile", function(res) {
fetchedInfo = $(res).find("span#username").attr("href");
alert(fetchedInfo);
});
HTML:
<div class="linkdiv">
<span class="profile" id="username">
<a href="https://example.com">text</a>
</span>
</div>
Every answer I've tried from StackOverflow has resulted in a blank Alert. I'm not sure if there's something way deeper going on from my end of things or if it's still (hopefully) a fixable code issue...
Thank you for any help.