url 末尾的广告锚

Ad anchor at the end of url

我必须在下面的js中添加几行。 我想要做的是在 URL "%%cta%%" 的末尾添加一个#id。 有人能帮我吗?非常感谢!

thisthing.replaceData = function (thisTemplate, htmlList, htmlOverlayer, dataJs, indexLi) {
    //thisTemplate = thisTemplate.replace('%%img%%', '/B2C/ResourcesWebRevise/booking/thisthing/custom/' + dataJs + '.jpg');
    thisTemplate = thisTemplate.replace('%%title%%', thisthingData.title);
    thisTemplate = thisTemplate.replace('%%desc%%', thisthingData.desc);
    thisTemplate = thisTemplate.replace('%%cta%%', thisthingData.cta); // bridge cta
    thisTemplate = thisTemplate.replace('%%list%%', htmlList);
    thisTemplate = thisTemplate.replace('%%overlayer%%', htmlOverlayer);
    thisthing.print(thisTemplate, dataJs, indexLi);
}

希望这就是您所需要的。只需使用 +=.

添加到字符串末尾
thisthing.replaceData = function(thisTemplate, htmlList, htmlOverlayer, dataJs, indexLi) {
  //thisTemplate = thisTemplate.replace('%%img%%', '/B2C/ResourcesWebRevise/booking/thisthing/custom/' + dataJs + '.jpg');
  thisTemplate = thisTemplate.replace('%%title%%', thisthingData.title);
  thisTemplate = thisTemplate.replace('%%desc%%', thisthingData.desc);
  thisTemplate = thisTemplate.replace('%%cta%%', thisthingData.cta); // bridge cta
  thisTemplate = thisTemplate.replace('%%list%%', htmlList);
  thisTemplate = thisTemplate.replace('%%overlayer%%', htmlOverlayer);
  thisTemplate += "#id"; // Pretty simple
  thisthing.print(thisTemplate, dataJs, indexLi);
}