Using GetCurrentResourceName in my UI?

How can I use GetCurrentResourceName in my JS? I don’t want my callback’s resource name to be static but when I try to do the following:

$.post(`https://${GetCurrentResourceName()}/sendtext`, JSON.stringify({text}));

It gives me a error that GetCurrentResourceName isn’t defined, so how would I go about doing it?

Try getting it from the window.location

location.host

Actually should GetParentResourceName() also works

Just replace it with location.host?

Actually you can use GetParentResourceName() too