How to use the path of url as text element on screen? I realized its a problem of type of data (string vs text), but i don´t know how to fix
I only need to show on website, the path of url on it is
import wixLocation from ‘wix-location’;
$w.onReady( function () {
let path = wixLocation.path;
$w(“#text88”).text = path
});
I figured out! I need to convert the location path to string:
$w.onReady( function () {
let path = wixLocation.path;
path = path.toString();
$w(“#text89”).text = path
});
For some reason that returns the path + ,profile, e.g. 8bd9d284-7692-495a-bd31-3ed892a450f7,profile. To get the ID of the owner of the page (in my case the ‘About Me’-page of the member pages) I added the following:
var ownerID = path.substr( 0 , path.length - 8 );
Whole code:
import wixLocation from ‘wix-location’ ;
$w.onReady( function () {
let path = wixLocation.path;
path = path.toString();
var ownerID = path.substr( 0 , path.length - 8 );
$w( ‘#text31’ ).text = ownerID;
});
This is used for a data query to show uploaded items of a member on his ‘about me’ page.