import wixUsers from 'wix-users';
import wixData from 'wix-data';
import wixLocation from 'wix-location';
$w.onReady(function () {
$w("#offerButton").onClick( (event) => {
let slugslug = $w('#text128').text;
wixLocation.to("/usersposts/" + slugslug)
console.log("/usersposts/" + slugslug);
})
});
the screenshot below shows the page the above code runs on (#text128 and #offerButton inside a repeater) #text128 connects to usersPosts which gets a users slug
Hi I checked your code. i received a error due to missing ) at the end of the event. Try to use a log to track the value of the text. From what I checked, it should work
@bill24563 You’ve explained that you’re struggling to link to a specific dynamic URL in a repeater. If I’m understanding correctly, this seems entirely backwards. It seems like you’re linking to the dynamic URL just fine. The real question ought to be: how do I respond at a particular URL and serve the appropriate content?
In other words, where should it link? Give an example of the correct URL. Show what content should appear at that URL. If you’ve taken no action to serve content at this URL then that’s obviously why the page 404s.
So the contents of #text128 (see screenshot below) should provide the suffix for the URL. On the page below, #text128 is connected to usersPosts dataset, which displays a users slug on the live site.
Oops! I see your mistake now. I should have spotted it sooner not least because it’s a common one we see fairly regularly. You were asking roughly the right questions.
Have a read of the above and try to digest it. The code snippet you want to be adapting is this one. You need to use the return value of $w.at to grab the right #text128.