Hi All,

I have one index.php like below

<script type="text/javascript">
ajax function to call page1, page2 etc...



<div id="leftcolumn">
<a href="javascript:ajaxpage('page1.php', 'rightcolumn');">Page1</a>
<a href="javascript:ajaxpage('page2.php', 'rightcolumn');">Page2</a>
<a href="javascript:ajaxpage('page3.php', 'rightcolumn');">Page3</a>


<div id="rightcolumn"><h3>Choose a page to load.</h3></div>
<div style="clear: left; margin-bottom: 1em"></div>



Now if page1 is calling some other page say page4 as


<a href="javascript:ajaxpage('page4.php', 'rightcolumn');">page4</a>


Here I am unable to understand how to do this as page1 does not have any div with name rightcolumn and also it does not have the ajaxpage script.

Please let me know how to do this....I hope I am clear.

6 Years
Discussion Span
Last Post by gauri_agr

On index.php, when you call ajaxpage('page1.php', 'rightcolumn');

then your rightcolumn will have html - the html from page1.php:

<div id="rightcolumn">
<a href="javascript:ajaxpage('page4.php', 'rightcolumn');">page4</a>

When you click on page4, it should load it into the rightdiv of index.php because that link now exists within index.php.

On another note, page1.php should NOT send any element with id="rightcolumn" because index.php already has an element with that id. An id MUST be unique throughout the document even if you are populating elements via ajax.


thanks a lot. It is so easy to use ajax. This is working perfectly...thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.