How to use member data as a variables in pages

I have pages where we are using member database to allow access to web-page. After registration the customer can register to different courses. I’d like to use member data to pre-fill the registration fields. This is how I collect the registration data.

$w.onReady( function () {
// Write your JavaScript here
$w( ‘#register’ ).onClick( function (){
let firstName =$w( ‘#firstName’ ).value;
let familyName =$w( ‘#familyName’ ).value;
let email =$w( ‘#email’ ).value;
let password =$w( ‘#password’ ).value;
let phone =$w( ‘#phone’ )
.then(()=>{ ‘/’ );

How could I import the user data from that database to global variable to be used to present data in registration pages as profiled data for the user?