PDA

View Full Version : javascript on Ajax



pablitobs
08-03-2006, 05:07 AM
1) Script Title: Ajax Tabs Content script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm

3) Describe problem: Hi there may be you will not helpme on this but I hope you can I want to run this script

http://www.softcomplex.com/products/tigra_tree_menu_pro/

inside the ajax tabs content.

1. I am sure the tigra menu workd fine, because if I run just the page that contains the tigra menu it runs.
2.the problem is that I need to run this javascript code inside the ajax tabs content:
<script language="JavaScript">
new tree (<?php echo $tree_items ?>, TREE_TPL);
</script>

As you can see the first parameter of the function is a dynamic javascript variable...again I tested out of the ajax tabs and it works.

so this script has to load this other js scripts in order to run

<link rel="stylesheet" href="tree.css">
<script language="JavaScript" src="tree.js"></script>
<script language="JavaScript" src="tree_tpl.js"></script>

so I just call it like this:

<ul id="maintab" class="shadetabs">
<li ><a href="#default" rel="ajaxcontentarea"><img src="images/search.gif" border="0" align="top">&nbsp;Search</a></li>
<li><a href="faq.php?idcategory=-1" rel="ajaxcontentarea" rev="tree.css,tree.js,tree_tpl.js" ><img src="images/folders.gif" border="0" align="top">&nbsp;Categories</a></li>

<li class="selected"><a href="faq.php?idcategory=<?php echo $_REQUEST['idcategory']?>" rel="ajaxcontentarea" rev="faq.php?idcategory=<?php echo $_REQUEST['idcategory']?>"><img src="images/questions.gif" border="0" align="top">&nbsp;<?php echo $_REQUEST['catname']?></a></li>
</ul>

<div id="ajaxcontentarea" class="contentstyle">
<p>Please insert your keywords to search in our F.A.Q.</p>
</div>

<script type="text/javascript">
//Start Ajax tabs script for UL with id="maintab" Separate multiple ids each with a comma.
startajaxtabs("maintab")
</script>

but I know the funciton

<script language="JavaScript">
new tree (<?php echo $tree_items ?>, TREE_TPL);
</script>

cannot be run in the internal page on the ajax tabs, so how can I execute that function.

Again...I testes outsite the ajax and the menu works!!!
please help,
thanks

takuhii
08-17-2006, 01:52 PM
I too have a similar problem, if you find a way round this I would be very interested to learn how you did it. Similarly if I find a way round my problem I will let you know ;)

Regards