troubleshooting Question

Ajax/php - how to get anchor tag to work

Avatar of saabStory
saabStoryFlag for United States of America asked on
JavaScriptPHP
3 Comments1 Solution822 ViewsLast Modified:
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:


<?php
if ($row['additionalOffices'] == 1) {
echo "<div><a href='#additionalOffices'>Additional Offices</a></div>";
}
?>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros