Avatar of saabStory
Flag for United States of America

asked on 

Ajax/php - how to get anchor tag to work

This is probably dirt simple but I can't figure it out nor have I been able to find anything on it.

I'm doing a page of office locations with php and ajax.  In some instances there is additional office information that needs to be displayed later in the page.  The problem I'm having is that when I use the '#' to indicate the anchor, the link won't display.  When I get the link text to display, it blows out the page.  I've tried double quotes, unicode, escaping the '#' sign in multiple ways but if the '#' sign is explicitly there, the link won't display and if it's not, it tries to open another page.

Is there a way to include an anchor tag as part of some ajax output and have it go to another part of the page normal?  The snippet I'm using, for what it's worth is below:

if ($row['additionalOffices'] == 1) {
echo "<div><a href='#additionalOffices'>Additional Offices</a></div>";

Open in new window


Avatar of undefined
Last Comment

8/22/2022 - Mon