I have a member profile page which displays an username in regular text,(h1). I can capture the username using Javascript using this code
<script type="text/javascript">
var userID = document.getElementsByClassName("display-name")[0].innerHTML;
</script>
Q: What I want to know is, is there a way to get that variable and sent it back to my database? And add the username if it's an unique username.
P.S.
- I'm running a Wordpress site, database is (phpMyAdmin).
- I've read the $_POST methods for javascript/php transfers. But I don't see how I can apply it here, because there is no form to submit anything in.
- The username gets generated by itself (using a plugin) that's why I'm doing it this way.