That's what I have:
<a href="<?=$arItem["LINK"]?>#nav-link">LinkName</a>
Here <?=$arItem["LINK"]?> I'm getting some link, and I want to add to the end of this link some extra hashtag parameter #nav-link.
But the main problem is that PHP is executing on the server side, so, when I click the link, I get only link from the <?=$arItem["LINK"]?> (blabla.com). After second click, I have necessary code blabla.com/#nav-link.
So, is it possible to get blabla.com/#nav-link after first click?
-
use anything but the # if you want it to be sent to the server and not just the browseruser557846– user5578462014年10月01日 19:52:30 +00:00Commented Oct 1, 2014 at 19:52
-
You could set a var in jquery and have PHP populate that variable with what you want and then use that var in your code further down the line.Mr. Concolato– Mr. Concolato2014年10月01日 19:53:54 +00:00Commented Oct 1, 2014 at 19:53
-
If you want to change the link after the page loads - why don't you just use jQuery to append the link instead of relying on PHP?John Reid– John Reid2014年10月02日 08:44:17 +00:00Commented Oct 2, 2014 at 8:44
1 Answer 1
Try something to the tune of this:
<script>
var data = <?php echo $arItem["LINK"]; ?>
var yourLink = "blabla.com/"+data;
//more of your code etc....
$('#yourDiv_where_you_want_the_link').html(yourLink);
</script>
answered Oct 1, 2014 at 20:02
Mr. Concolato
2,2505 gold badges25 silver badges45 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default