Linking search results to Dynamic Pages

I’ve tried the following variations with no joy :frowning:

function linktolocolog () {
$w('#Shunters').onReady(() => {
  $w("#container2").onClick( (event) => {
 
 let $item =  $w.at(event.context);
 let currentItem = $item('#Shunters').getCurrentItem();
 let dynamicPageID = `${currentItem.number}`
 let collectionID = `${currentItem.title}`
   console.log('https://www.ukraillog.co.uk/'+collectionID+'/'+dynamicPageID);
 wixLocation.to('https://www.ukraillog.co.uk/'+collectionID+'/'+dynamicPageID);
 }); 
})
}
function linktolocolog () {
  $w("#container2").onClick( (event) => {
     $w('#Shunters').onReady(() => {
 let $item =  $w.at(event.context);
 let currentItem = $item('#Shunters').getCurrentItem();
 let dynamicPageID = `${currentItem.number}`
 let collectionID = `${currentItem.title}`
   console.log('https://www.ukraillog.co.uk/'+collectionID+'/'+dynamicPageID);
 wixLocation.to('https://www.ukraillog.co.uk/'+collectionID+'/'+dynamicPageID);
 }); 
})
}

I’ve also changed the container 2 part to the specific text box within the container which relates to the number field.

All of these have resulted in the same outcome - the console log recording the correct url, but there being no actual redirection.

If anyone can give me some pointers as to where I am going wrong with this, it would be massively appreciated :slight_smile:

Thanks