PDA

View Full Version : cant link/navigate to a target/anchor within an ajax loaded page



rafael
08-04-2018, 04:26 PM
1) Script Title: Dynamic Ajax Content

2) Script URL: http://dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe Problem: i am unable to link to a specific place within the Ajax loaded content, including the top of a page/window.

for example, in my page, test.php, i have several anchors, such as
<A name=section2></A>

this is how i'm composing the links at the moment, with the anchor referenced immediately after the hashtag.


<a href="javascript:ajaxpage('test.php#section2', 'ContentArea');">midway</a>
...
<div id="ContentArea"></div>

i end up with test.php loaded in the container, ContentArea, but not midway down the window to my anchor.

additionally, none of the linked-to content is loaded by default to the top of the window/page.
so i am forced to scroll up to the top of the page to browse the content from the start.

in short
<a href="javascript:ajaxpage('test.php#section2', 'ContentArea');">midway</a> does not take me to
<A name=section2></A>

and nor does
<a href="javascript:ajaxpage('newpage.php', 'ContentArea');">new page</a> take me to the top of newpage.php

thanks in advance